Image encoding / decoding method, and apparatus for transmitting compressed video data
Patent Information
- Application Number
- PCT/KR2026/003145
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-03-20
- Filing Date
- 2026-02-25
- Publication Date
- 2026-09-03
Smart Images

Figure KR2026003145_03092026_PF_FP_ABST
Abstract
Description
Video encoding / decoding method and device for transmitting compressed video data
[0001] The present disclosure relates to a video signal processing method and apparatus.
[0002] Recently, the demand for high-resolution, high-quality video, such as HD (High Definition) and UHD (Ultra High Definition) video, has been increasing across various application fields. As video data becomes higher in resolution and quality, the relative volume of data increases compared to conventional video data; consequently, transmission and storage costs increase when video data is transmitted using existing wired or wireless broadband lines or stored using conventional storage media. To address these issues arising from the increase in video data resolution and quality, high-efficiency video compression technologies can be utilized.
[0003] Various video compression technologies exist, such as inter-frame prediction technology that predicts pixel values in the current picture from previous or subsequent pictures, intra-frame prediction technology that predicts pixel values in the current picture using pixel information within the current picture, and entropy coding technology that assigns short codes to values with high frequency and long codes to values with low frequency; by utilizing these video compression technologies, video data can be effectively compressed for transmission or storage.
[0004] Meanwhile, along with the increasing demand for high-resolution video, the demand for stereoscopic video content as a new video service is also rising. Discussions are underway regarding video compression technologies to effectively provide high-resolution and ultra-high-resolution stereoscopic video content.
[0005] The present disclosure aims to provide a method for deriving a candidate for temporal motion information from an optimal candidate among a plurality of candidate locations.
[0006] The present disclosure aims to provide a method for separating / decomposing a current block into multiple regions and sequentially encoding / decoding the multiple regions.
[0007] The present disclosure aims to provide a method for filtering prediction blocks through transformation and inverse transformation.
[0008] The technical problems to be solved in this disclosure are not limited to those mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art to which this disclosure belongs from the description below.
[0009] A video decoding method according to the present disclosure may include the step of deriving motion information of a current block; and the step of obtaining a predicted block of the current block based on the motion information. In this case, the motion information is derived from a motion information merging candidate list of the current block, the motion information merging candidate list includes a temporal motion information merging candidate, and the temporal motion information merging candidate may be derived based on the motion information of the location candidate with the smallest template matching cost among a plurality of location candidates within a collocated picture.
[0010] In the image decoding method according to the present disclosure, the plurality of position candidates includes a first position candidate existing inside a collocated region within the collocated picture and a second position candidate existing outside the collocated region, and the collocated region may have the same size and position as the current block within the collocated picture.
[0011] In the image decoding method according to the present disclosure, the plurality of temporal position candidates may include a third position candidate indicated by the initial motion vector of the current block in the collocated picture.
[0012] In the image decoding method according to the present disclosure, the initial motion vector may be derived from a sample at a position adjacent to the current block.
[0013] In the image decoding method according to the present disclosure, the template matching cost can be calculated based on the template of the current block and a reference template specified by the movement information of the location candidate.
[0014] In the image decoding method according to the present disclosure, the motion information of the position candidate is changed to match the target reference picture, and the reference template can be specified by the changed motion information of the position candidate.
[0015] In the image decoding method according to the present disclosure, the motion information of the position candidate is corrected based on a scaling parameter, and the reference template can be specified by the corrected motion information of the position candidate.
[0016] In the image decoding method according to the present disclosure, the scaling parameter may be determined based on the distance between the collocated picture and the target reference picture and the distance between the collocated picture and the reference picture indicated by the motion information of the position candidate.
[0017] The image decoding method according to the present disclosure may further include the step of updating the prediction block. In this case, the updated prediction block may be obtained by performing a transformation and an inverse transformation on the prediction block.
[0018] In the image decoding method according to the present disclosure, the transformation and the inverse transformation may be performed on a transformation target area including the prediction block.
[0019] In the image decoding method according to the present disclosure, the size of the conversion target area can be adaptively determined according to the size of the current block.
[0020] In the image decoding method according to the present disclosure, at least one of the transformation coefficients obtained by the transformation may be changed to 0.
[0021] In the image decoding method according to the present disclosure, the prediction block has a size expanded compared to the current block, and among the samples output through the transformation and the inverse transformation within the transformation target area, an area of the same size as the current block may be set as the updated prediction block.
[0022] A video encoding method according to the present disclosure may include the step of deriving motion information of a current block; and the step of obtaining a predicted block of the current block based on the motion information. In this case, the motion information is derived from a motion information merging candidate list of the current block, the motion information merging candidate list includes a temporal motion information merging candidate, and the temporal motion information merging candidate may be derived based on the motion information of the position candidate with the smallest template matching cost among a plurality of position candidates within a collocated picture.
[0023] According to the present disclosure, a computer-readable recording medium may be provided that records instructions for storing / transmitting a bitstream generated by an image encoding method.
[0024] According to the present disclosure, a computer-readable recording medium may be provided that records instructions for performing an image decoding method or an image encoding method.
[0025] 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.
[0026] According to the present disclosure, prediction accuracy can be improved by deriving a candidate for temporal motion information from the optimal candidate among a plurality of candidate locations.
[0027] According to the present disclosure, the encoding / decoding efficiency can be improved by separating / decomposing the current block into multiple regions and sequentially encoding / decoding the multiple regions.
[0028] According to the present disclosure, prediction accuracy can be improved by filtering the prediction block through transformation and inverse transformation.
[0029] The effects obtainable from the present disclosure are not limited to those mentioned above, and other unmentioned effects will be clearly understood by those skilled in the art to which the present disclosure pertains from the description below.
[0030] FIG. 1 is a block diagram showing an image encoding device according to one embodiment of the present disclosure.
[0031] FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present disclosure.
[0032] FIG. 3 illustrates an image encoding / decoding method performed by an image encoding / decoding device according to the present disclosure.
[0033] FIG. 4 illustrates an example of a plurality of intra-prediction modes according to the present disclosure.
[0034] Figure 5 shows an example where the directional mode is extended.
[0035] FIG. 6 illustrates a planner mode-based intra prediction method according to the present disclosure.
[0036] FIG. 7 illustrates a DC mode-based intra prediction method according to the present disclosure.
[0037] FIG. 8 illustrates an intra-prediction method based on a directional mode according to the present disclosure.
[0038] Figure 9 illustrates a method for deriving samples of fractional positions.
[0039] Figures 10 and 11 illustrate tangent values for angles scaled by 32 times for each intra prediction mode.
[0040] FIG. 12 is a diagram illustrating an intra-prediction pattern when the directional mode is one of modes 34 to 49.
[0041] Figure 13 is a diagram illustrating an example of generating an upper reference sample by interpolating left reference samples.
[0042] Figure 14 shows an example in which intra prediction is performed using reference samples arranged in a 1D array.
[0043] Figure 15 is a diagram illustrating an example of setting a reference area.
[0044] Figure 16 is a diagram showing an example of the configuration of a reference area.
[0045] Figure 17 illustrates the filter coefficients for the Sobel mask and the Prewit mask, respectively.
[0046] Figure 18 shows the locations where the vertical and horizontal inclinations are obtained within the reference area.
[0047] Figure 19 shows an example of grouping directional modes into multiple intra-prediction mode groups.
[0048] FIG. 20 is a drawing illustrating a reference area around the current block.
[0049] Figures 21 and 22 illustrate an example of performing intra prediction on a reference area based on planner mode.
[0050] Figures 23 and 24 illustrate an example of performing intra prediction on a reference region based on DC mode.
[0051] Figures 25 and 26 illustrate an example of performing intra prediction on a reference region based on a directional mode.
[0052] Figure 27 is a flowchart illustrating a method for predicting a chroma block using a restored luminance block.
[0053] FIGS. 28 to 30 show examples of downsampling a luma block.
[0054] Figure 31 is a diagram illustrating the process of performing inter-prediction in the encoder and decoder.
[0055] Figure 32 shows an example where motion estimation is performed.
[0056] Figures 33 and 34 show examples in which a predicted block of the current block is generated based on motion information generated through motion estimation.
[0057] Figure 35 shows the location referenced to derive the motion vector prediction value.
[0058] Figure 36 is a diagram illustrating a template-based motion estimation method.
[0059] Figure 37 shows examples of template configurations.
[0060] Figure 38 is a diagram illustrating a motion estimation method based on a two-way matching method.
[0061] FIG. 39 is a diagram illustrating a motion estimation method based on a unidirectional matching method.
[0062] Figures 40 and 41 illustrate examples in which prediction blocks are generated according to the precision of the motion vectors.
[0063] FIG. 42 shows an example in which motion compensation based on a translational model and a zooming model is performed for the current block.
[0064] FIG. 43 shows an example in which motion compensation based on a translational model and a rotational model is performed for the current block.
[0065] Figures 44 and 45 show an example of generating a prediction block for the current block using control point motion vectors.
[0066] Figure 46 shows an example of generating a prediction block for the current block using three control point motion vectors.
[0067] Figure 47 shows an example in which motion vectors are derived in sub-block units.
[0068] Figures 48 and 49 show examples in which motion vectors are induced in units of sub-blocks within the current block when SbTMVP is applied.
[0069] Figures 50 and 51 are diagrams illustrating examples in which a prediction block is derived according to the precision of the motion vector.
[0070] Figures 52 and 53 are diagrams illustrating the process of encoding and decoding motion vector difference values when the AMVR method is applied, respectively.
[0071] Figure 54 is a diagram showing the location of the collocated block.
[0072] Figure 55 shows an example where the movement information of a collocated block is changed.
[0073] FIGS. 56 to 58 are drawings for explaining an example of calculating the cost of multiple location candidates.
[0074] FIG. 59 is a diagram illustrating a search area where the prediction vector of the current block is derived.
[0075] Figure 60 shows an example where the current block is separated into multiple regions.
[0076] Figure 61 shows an example in which a prediction is performed for the first region.
[0077] FIG. 62 shows an example in which encoding / decoding is performed in block units that integrate multiple sub-blocks.
[0078] FIG. 63 illustrates general directional intra prediction modes and opposite directional intra prediction modes.
[0079] Figure 64 shows an example in which intra prediction is performed based on a reverse intra prediction mode.
[0080] FIG. 65 illustrates an example in which intra prediction is performed for a sub-block belonging to a second region based on a non-directional intra prediction mode.
[0081] Figure 66 shows an example in which reference samples used to derive the average value are set differently depending on the sub-block or current block shape.
[0082] Figure 67 is a diagram illustrating luminance reference samples and chroma reference samples used to derive prediction parameters.
[0083] Figures 68 and 69 show examples of how the current block is separated by line.
[0084] Figure 70 shows an example in which samples included in the first region are predicted using restoration samples included in the second region.
[0085] Figure 71 shows an example of predicting samples included in the first region based on a non-directional intra prediction mode.
[0086] Figure 72 shows an example where multiple samples at discontinuous locations are defined as a single region.
[0087] FIG. 73 illustrates an example in which restoration samples of residual regions are derived based on restoration samples of regions where explicit encoding / decoding is performed.
[0088] FIG. 74 is a flowchart of a method for performing encoding / decoding by separating / decomposing the current block into multiple regions.
[0089] Figure 75 is a flowchart of a method for encoding a residual block in an encoder.
[0090] Figure 76 is a flowchart of a method for recovering residual blocks in a decoder.
[0091] Figures 77 and 78 are drawings showing an example to which the second transformation is applied.
[0092] FIGS. 79 and FIGS. 80 illustrate a second transformation based on an asymmetric form second transformation kernel.
[0093] Figure 81 shows an example in which information about partial transformations is sequentially encoded / decoded.
[0094] Figure 82 shows an example of a case where a partial transformation is applied to the current block.
[0095] Figures 83 and 84 show examples of performing filtering using a transformation on a prediction block.
[0096] FIGS. 85 and 86 show examples in which zeroing is performed for conversion coefficients belonging to the high-frequency region.
[0097] Figure 87 shows an example in which a predicted block larger than the current block is obtained.
[0098] The present disclosure is susceptible to various modifications and may have various embodiments; 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, and it should be understood that it includes all modifications, equivalents, and substitutions that fall within the spirit and scope of the present disclosure. Similar reference numerals have been used for similar components in the description of each drawing.
[0099] Terms such as "first," "second," etc., may be used to describe various components, but said components should not be limited by said terms. Such terms are used solely for the purpose of distinguishing one component from another. For example, without departing from the scope of the present disclosure, the first component may be named the second component, and similarly, the second component may be named the first component. The term "and / or" includes a combination of a plurality of related described items or any of a plurality of related described items.
[0100] When it is stated that one component is "connected" or "connected" to another component, it should be understood that while it may be directly connected or connected to that other component, there may also be other components in between. On the other hand, when it is stated that one component is "directly connected" or "directly connected" to another component, it should be understood that there are no other components in between.
[0101] The terms used in this application are used merely to describe specific embodiments and are not intended to limit the disclosure. The singular expression includes the plural expression unless the context clearly indicates otherwise. In this application, terms such as “comprising” or “having” are intended to specify the presence of the features, numbers, steps, actions, components, parts, or combinations thereof described in the specification, and should be understood as not precluding the existence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.
[0102] Hereinafter, preferred embodiments of the present disclosure will be described in more detail with reference to the attached drawings. Hereinafter, the same reference numerals are used for identical components in the drawings, and redundant descriptions of identical components are omitted.
[0103] FIG. 1 is a block diagram showing an image encoding device according to one embodiment of the present disclosure.
[0104] Referring to FIG. 1, the image encoding device (100) may include a picture splitting unit (110), a prediction unit (120, 125), a conversion unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse conversion unit (145), a filter unit (150), and a memory (155).
[0105] Each component shown in FIG. 1 is depicted independently to represent different characteristic functions of the image encoding device and does not imply that each component consists of separate hardware or a single software unit. That is, each component is listed and included as a separate component for convenience of explanation, but at least two of the components may be combined to form a single component, or a single component may be divided into multiple components to perform functions, and such integrated and separated embodiments of each component are included within the scope of the present disclosure as long as they do not deviate from the essence of the present disclosure.
[0106] Additionally, some components may not be essential components performing an essential function in the present disclosure, but may be optional components merely for enhancing performance. The present disclosure may be implemented by including only the components essential to embody the essence of the present disclosure, excluding components used merely for enhancing performance, and a structure including only the essential components, excluding optional components used merely for enhancing performance, is also included within the scope of the rights of the present disclosure.
[0107] The picture segmentation unit (110) can divide 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 segmentation unit (110) can divide a picture into a combination of multiple coding units, prediction units, and transformation units, and can encode the picture by selecting one combination of coding units, prediction units, and transformation units based on a predetermined criterion (e.g., a cost function).
[0108] For example, a single picture can be divided into multiple coding units. To divide coding units within a picture, recursive tree structures such as a Quad Tree, Ternary Tree, or Binary Tree can be used. A coding unit divided into other coding units, with a single image or the largest coding unit as the root, can have as many child nodes as the number of divided coding units. A coding unit that is no longer divided according to certain limits becomes a leaf node. For example, assuming Quad Tree division is applied to a single coding unit, a single coding unit can be divided into up to four different coding units.
[0109] In the embodiments of the present disclosure below, the encoding unit may be used to mean a unit that performs encoding, or a unit that performs decoding.
[0110] A prediction unit may be divided into at least one shape, such as a square or rectangle, of the same size within a single encoding unit, or one of the prediction units divided within a single encoding unit may be divided such that any one prediction unit has a different shape and / or size from another prediction unit.
[0111] When performing intra-frame prediction, the transformation unit and the prediction unit may be set to be the same. In this case, the encoding unit may be divided into multiple transformation units, and intra-frame prediction may be performed for each transformation unit. The encoding unit may be divided in a horizontal or vertical direction. The number of transformation units generated by dividing the encoding unit may be two or four, depending on the size of the encoding unit. Alternatively, if the size of the transformation unit is small, multiple transformation units may be set as a single prediction unit.
[0112] The prediction unit (120, 125) may include an inter-frame prediction unit (120) that performs inter-frame prediction and an intra-frame prediction unit (125) that performs intra-frame prediction. It may determine whether to use inter-frame prediction or perform intra-frame prediction for a encoding unit, and determine specific information (e.g., reference sample line, intra-frame prediction mode, motion vector, reference picture, etc.) according to each prediction method. At this time, the processing unit in which the prediction is performed and the processing unit in which the prediction method and specific details are determined may be different. For example, the prediction method and prediction mode, etc., may be determined by the encoding unit, and the prediction may be performed by the prediction unit or the conversion unit. The residual value (residual block) between the generated prediction block and the original block may be input to the conversion unit (130). In addition, the prediction mode information, motion vector information, etc. used for 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).
[0113] The inter-frame 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 partially encoded area within the current picture. The inter-frame prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.
[0114] In the reference picture interpolation unit, reference picture information is received from memory (155), and pixel information of integer pixels or less can be generated from the reference picture. In the case of luminance pixels, a DCT-based 8-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 4 pixel units. In the case of chrominance signals, a DCT-based 4-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 8 pixel units.
[0115] 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 calculate motion vectors. Based on the interpolated pixels, the motion vector can have motion vector values in units of 1 / 2 or 1 / 4 pixels. The motion prediction unit can predict the current prediction unit by using different motion prediction methods. Various motion prediction methods, such as the Skip method, Merge method, AMVP (Advanced Motion Vector Prediction) method, and Intra Block Copy method, can be used.
[0116] The in-screen prediction unit (125) can generate a prediction block based on reference pixel information, which is pixel information within the current picture. Reference pixel information can be derived from one selected from a plurality of reference pixel lines. The Nth reference pixel line among the plurality of reference pixel lines may include left pixels with an x-axis difference of N with the top-left pixel in the current block and top pixels with a y-axis difference of N with said top-left pixel. The number of reference pixel lines that the current block can select may be 1, 2, 3, or 4.
[0117] If a neighboring block of the current prediction unit is a block that has undergone inter-frame prediction, and the reference pixel is a pixel that has undergone inter-frame prediction, the reference pixel included in the block that has undergone inter-frame prediction can be replaced with the reference pixel information of a neighboring block that has undergone intra-frame prediction. That is, if the reference pixel is not available, the information of the unavailable reference pixel can be replaced with the information of at least one of the available reference pixels.
[0118] In intra-frame prediction, the prediction mode may include 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 may be different, and the intra-frame prediction mode information used to predict luminance information or the predicted luminance signal information may be utilized to predict chrominance information.
[0119] When performing intra-frame prediction, if the size of the prediction unit and the size of the transformation unit are the same, intra-frame prediction for the prediction unit can be performed based on the pixels to the left of the prediction unit, the pixels at the top left, and the pixels at the top.
[0120] The in-frame prediction method can generate a prediction block after applying a smoothing filter to a reference pixel according to the prediction mode. Depending on the selected reference pixel line, it may be determined whether to apply the smoothing filter.
[0121] To perform an intra-frame prediction method, the intra-frame prediction mode of the current prediction unit can be predicted from the intra-frame prediction mode of the prediction unit existing in the vicinity of the current prediction unit. When predicting the prediction mode of the current prediction unit using the mode information predicted from the surrounding prediction unit, if the intra-frame prediction mode of the current prediction unit and the surrounding prediction unit are the same, information indicating that the prediction modes of the current prediction unit and the surrounding prediction unit are the same can be transmitted using predetermined flag information; if the prediction modes of the current prediction unit and the surrounding prediction unit are different, entropy coding can be performed to encode the prediction mode information of the current block.
[0122] Additionally, a residual block can be generated that includes residual value information, which is the difference between the prediction unit that performed the prediction based on the prediction unit generated in the prediction unit (120, 125) and the original block of the prediction unit. The generated residual block can be input to the conversion unit (130).
[0123] In the transformation unit (130), the residual block containing 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 in-frame prediction mode information of the prediction unit. Meanwhile, the transformation can be performed by separating the horizontal direction and the vertical direction.
[0124] After performing transformations for the horizontal and vertical directions, a second transformation can be performed. The second transformation may be in a form where the horizontal and vertical directions are not separated. Final transformation coefficients can be generated by performing a second transformation on the transformation coefficients obtained by the first transformation. Meanwhile, the number of final transformation coefficients output by the second transformation may be smaller than the number of transformation coefficients input for the second transformation. Specifically, the second transformation can be performed using a reduced transformation matrix with different numbers of columns and rows.
[0125] The quantization unit (135) can quantize the values converted into the frequency domain in the conversion unit (130). The quantization coefficient may vary depending on the block or the importance of the image. The values produced by the quantization unit (135) may be provided to the inverse quantization unit (140) and the reordering unit (160).
[0126] The reordering unit (160) can perform reordering of coefficient values for quantized residual values.
[0127] The reordering unit (160) can convert two-dimensional block-shaped coefficients into one-dimensional vector forms through a coefficient scanning method. For example, the reordering unit (160) can convert the coefficients from DC to high-frequency ranges into one-dimensional vector forms by scanning using a Zig-Zag Scan method. Depending on the size of the conversion unit and the in-frame prediction mode, instead of Zig-Zag Scan, a vertical scan that scans two-dimensional block-shaped coefficients in the column direction, a horizontal scan that scans two-dimensional block-shaped coefficients in the row direction, or a diagonal scan that scans two-dimensional block-shaped coefficients in the diagonal direction may be used. That is, depending on the size of the conversion unit and the in-frame prediction mode, it can be determined whether to use a Zig-Zag Scan, a vertical scan, a horizontal scan, or a diagonal scan.
[0128] The entropy encoding unit (165) can perform entropy encoding based on the values calculated by the reordering unit (160). Entropy encoding can use various encoding methods, such as, for example, Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).
[0129] The entropy encoding unit (165) can encode various information from the reordering unit (160) and the prediction unit (120, 125), such as residual value coefficient information of the encoding unit, block type information, prediction mode information, division unit information, prediction unit information and transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information.
[0130] In the entropy encoding unit (165), the coefficient value of the encoding unit input from the reordering unit (160) can be entropy encoded.
[0131] In the inverse quantization unit (140) and 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 value generated in the inverse quantization unit (140) and inverse transformation unit (145) can be combined with the predicted unit predicted through the motion estimation unit, motion compensation unit, and in-frame prediction unit included in the prediction unit (120, 125) to generate a reconstructed block.
[0132] The filter section (150) may include at least one of a deblocking filter, an offset correction section, and an ALF (Adaptive Loop Filter).
[0133] The deblocking filter can remove block distortion caused by boundaries between blocks in the restored picture. To determine whether to perform deblocking, the decision to apply the deblocking filter to the current block can be made based on the pixels contained in a certain number of columns or rows within the block. When applying the deblocking filter to a block, a Strong Filter or a Weak Filter can be applied depending on the required deblocking filtering strength. Additionally, when applying the deblocking filter, horizontal and vertical filtering can be processed in parallel.
[0134] The offset correction unit can correct the offset from the original image on a pixel-by-pixel basis for the image that has undergone deblocking. To perform offset correction for a specific picture, a method can be used in which pixels included in the image are divided into a certain number of regions, the region to be offset is determined, and the offset is applied to that region, or a method can be used in which the offset is applied by considering the edge information of each pixel.
[0135] Adaptive Loop Filtering (ALF) can be performed based on a comparison between the filtered restored image and the original image. After dividing the pixels included in the image into predetermined groups, a single filter to be applied to each group can be determined, allowing for differential filtering for each group. Information regarding whether to apply ALF can be transmitted per coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied may vary depending on each block. Additionally, an ALF filter of the same form (fixed form) may be applied regardless of the characteristics of the block to be applied.
[0136] The memory (155) can store a restoration block or picture calculated through the filter unit (150), and the stored restoration block or picture can be provided to the prediction unit (120, 125) when performing inter-frame prediction.
[0137] FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present disclosure.
[0138] 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).
[0139] When a video bitstream is input to a video encoding device, the input bitstream can be decoded by the reverse procedure of the video encoding device.
[0140] The entropy decoding unit (210) can perform entropy decoding in the opposite procedure to that which the entropy encoding unit of the image encoding device performed entropy encoding. For example, various methods such as Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) may be applied in correspondence with the method performed by the image encoding device.
[0141] The entropy decoding unit (210) can decode information related to intra-frame prediction and inter-frame prediction performed by the encoding device.
[0142] The reordering unit (215) can perform reordering based on the method of reordering the entropy-decoded bitstream in the encoding unit in the entropy decoding unit (210). It can reorder by restoring the coefficients expressed in the form of a one-dimensional vector back into coefficients in the form of a two-dimensional block. The reordering unit (215) can perform reordering by receiving information related to the coefficient scanning performed in the encoding unit and scanning in reverse based on the scanning order performed in the encoding unit.
[0143] The inverse quantization unit (220) can perform inverse quantization based on the coefficient values of the rearranged block and the quantization parameters provided by the encoding device.
[0144] The inverse transform unit (225) can perform an inverse transform of the transform performed by the transform unit on the quantization result performed by the image encoding device. That is, it can perform at least one of an inverse transform of the second transform (second inverse transform) or an inverse transform for DCT, DST, and KLT (i.e., first inverse transform). The inverse transform can be performed based on a transmission unit determined by the image encoding device. The inverse transform unit (225) of the image decoder can determine a transform matrix for the second inverse transform or a transform technique for the first inverse transform (e.g., DCT, DST, KLT) according to a plurality of information such as a prediction method, the size and shape of the current block, a prediction mode, and an intra-frame prediction direction. Alternatively, information for determining the transform matrix or transform technique may be explicitly encoded and signaled.
[0145] The prediction unit (230, 235) can generate a prediction block based on the prediction block generation information provided by the entropy decoding unit (210) and the previously decoded block or picture information provided by the memory (245).
[0146] As described above, when performing intra-frame prediction identical to the operation in the video encoding device, if the size of the prediction unit and the size of the transform unit are the same, intra-frame prediction for the prediction unit is performed based on the pixels to the left of the prediction unit, the pixels to the top left, and the pixels to the top; however, if the size of the prediction unit and the size of the transform unit are different when performing intra-frame prediction, intra-frame prediction can be performed using reference pixels based on the transform unit. Additionally, intra-frame prediction using NxN partitioning only for the minimum encoding unit may also be used.
[0147] The prediction unit (230, 235) may include a prediction unit determination unit, an inter-frame prediction unit, and an intra-frame prediction unit. The prediction unit determination unit receives various information, such as prediction unit information input from the entropy decoding unit (210), prediction mode information of the intra-frame prediction method, and motion prediction related information of the inter-frame prediction method, distinguishes the prediction unit in the current encoding unit, and determines whether the prediction unit performs inter-frame prediction or intra-frame prediction. The inter-frame prediction unit (230) may perform inter-frame prediction for the current prediction unit based on information included in at least one picture among the previous picture or subsequent picture of the current picture containing the current prediction unit, using information necessary for inter-frame prediction of the current prediction unit provided by the video encoding device. Alternatively, it may perform inter-frame prediction based on information of a partially restored area within the current picture containing the current prediction unit.
[0148] To perform inter-frame prediction, based on the encoding unit, it is possible to determine whether the motion prediction method of the prediction unit included in the corresponding encoding unit is Skip Mode, Merge Mode, AMVP Mode, or Intra-frame Block Copy Mode.
[0149] The intra-frame 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-frame prediction, it can perform intra-frame prediction based on the intra-frame prediction mode information of the prediction unit provided by the video encoding device. The intra-frame prediction unit (235) may include an Adaptive Intra Smoothing (AIS) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on the reference pixel of the current block, and can determine whether to apply the filter based on the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixel of the current block using the prediction mode of the prediction unit and the AIS filter information provided by the video 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.
[0150] The reference pixel interpolation unit can generate a reference pixel of an integer value or less by interpolating the reference pixel when the prediction mode of the prediction unit is a prediction unit that performs intra-frame prediction based on the pixel value interpolated from the reference pixel. If 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 DC mode.
[0151] 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.
[0152] Information regarding whether a deblocking filter has been applied to the corresponding block or picture can be received from the video encoding device, and if a deblocking filter has been applied, information regarding whether a strong filter or a weak filter has been applied. The deblocking filter of the video decoder receives information related to the deblocking filter provided by the video encoding device, and the video decoder can perform deblocking filtering on the corresponding block.
[0153] The offset correction unit can perform offset correction on the restored image based on the type of offset correction and offset value information applied to the image during encoding.
[0154] ALF can be applied to the encoding unit based on information on whether to apply ALF, ALF coefficient information, etc., provided by the encoding device. This ALF information can be provided included in a specific parameter set.
[0155] The memory (245) can store the 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 the output unit.
[0156] As described above, in the embodiments of the present disclosure below, the term "Coding Unit" is used as "encoding unit" for convenience of explanation, but it may be a unit that performs not only encoding but also decoding.
[0157] Additionally, the current block represents a block to be encoded / decoded, and depending on the encoding / decoding stage, it may represent a coding tree block (or coding tree unit), an encoding block (or encoding unit), a conversion block (or conversion unit), a prediction block (or prediction unit), or a block to which an in-loop filter is applied. In this specification, 'unit' represents a basic unit for performing a specific encoding / decoding process, and '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 embodiments described below, the encoding block (coding block) and the encoding unit (coding unit) may be understood as having the same meaning.
[0158] In addition, encoding parameters for the current block may be commonly applied to multiple color components of the current block. For example, if the encoding mode of the current block is determined, predictions for the Y component block, Cb component block, and Cr component block can be performed based on the corresponding encoding mode.
[0159] Alternatively, depending on the color component to be encoded / decoded, the current block may refer to a Y component block, a Cb component block, or a Cr component block.
[0160] Furthermore, the picture containing the current block will be referred to as the current picture.
[0161] In the encoder, the current picture can be divided into multiple reference blocks. Here, the reference block may be referred to as a CTU (Coding Tree Unit) or CTB (Coding Tree Block).
[0162] The size of the reference block may be predefined in the encoder and decoder. Alternatively, information related to the size of the reference block may be encoded and signaled to the decoder. This information may be encoded / decoded through an upper header. For example, this information may be encoded / decoded through a sequence parameter set or a picture header.
[0163] The reference block may be further divided into multiple blocks (i.e., multiple coding blocks) based on tree structure partitioning. Here, the tree structure partitioning may include at least one of quad tree partitioning, binary tree partitioning, or ternary tree partitioning.
[0164] A prediction block for the current block can be obtained by performing a prediction block on the current block generated by dividing the reference block. Specifically, a prediction block for the current block can be obtained through inter-prediction or intra-prediction.
[0165] Inter-prediction may be intended to remove duplicate data between pictures, and intra-prediction may be intended to remove duplicate data within a picture. For example, a prediction block of the current block may be generated from a reference picture using motion information of the current block, or a prediction block of the current block may be generated from reference samples of the current block after determining the intra-prediction mode of the current block. Here, the motion information may include at least one of a motion vector, a reference picture index, and a prediction direction.
[0166] FIG. 3 illustrates an image encoding / decoding method performed by an image encoding / decoding device according to the present disclosure.
[0167] Referring to FIG. 3, a reference line for intra prediction of the current block can be determined (S300).
[0168] The current block may use one or more of the multiple reference line candidates predefined in the video encoding / decoding device as reference lines for intra-prediction. Here, the multiple reference line candidates predefined may include neighbor reference lines adjacent to the current block to be decoded and N non-neighbor reference lines located 1 to N samples away from the boundary of the current block. N may be 1, 2, 3, or more integers. For convenience of explanation, it is assumed that the multiple reference line candidates available to the current block consist of a neighbor reference line candidate and three non-neighbor reference line candidates, but are not limited thereto. That is, it is obvious that the multiple reference line candidates available to the current block may include four or more non-neighbor reference line candidates.
[0169] A video encoding device can determine an optimal reference line candidate among a plurality of reference line candidates and encode an index to specify it. A video decoding device can determine the reference line of the current block based on the index signaled through a bitstream. The index can specify any one of the plurality of reference line candidates. The reference line candidate specified by the index can be used as the reference line of the current block.
[0170] The number of signaled indices to determine the reference line of the current block may be one, two, or more. For example, if the number of signaled indices is one, the current block may perform intra prediction using only a single reference line candidate specified by the signaled index among multiple reference line candidates. Or, if the number of signaled indices is two or more, the current block may perform intra prediction using multiple reference line candidates specified by multiple indices among multiple reference line candidates.
[0171] Referring to FIG. 3, the intra prediction mode of the current block can be determined (S310).
[0172] The intra prediction mode of the current block can be determined from among a plurality of predefined intra prediction modes in the video encoding / decoding device. The plurality of predefined intra prediction modes will be examined with reference to FIGS. 4 and FIGS. 5.
[0173] FIG. 4 illustrates an example of a plurality of intra-prediction modes according to the present disclosure.
[0174] Referring to FIG. 4, a plurality of pre-defined intra-prediction modes in an image encoding / decoding device may be composed of non-directional modes and directional modes. The non-directional mode may include at least one of a planar mode or a DC mode. The directional mode may include directional modes 2 through 66.
[0175] The directional mode may be further extended than shown in FIG. 4. FIG. 5 shows an example of an extended directional mode.
[0176] In FIG. 5, modes -1 through -14 and modes 67 through 80 are shown as being added. These directional modes may be referred to as wide-angle intra-predicted modes. Whether to use wide-angle intra-predicted modes may be determined based on the shape of the current block. For example, if the current block is a non-square block where the width is greater than the height, some directional modes (e.g., 2 through 15) may be switched to wide-angle intra-predicted modes between 67 and 80. On the other hand, if the current block is a non-square block where the height is greater than the width, some directional modes (e.g., 53 through 66) may be switched to wide-angle intra-predicted modes between -1 and -14.
[0177] The range of available wide-angle intra prediction modes can be adaptively determined based on the width-to-height ratio of the current block. Table 1 shows the range of available wide-angle intra prediction modes based on the width-to-height ratio of the current block.
[0178] Width / Height Available Wide Angle Intra Predicted Mode Range W / H = 16 67~80 W / H = 8 67~78 W / H = 4 67~76 W / H = 2 67~74 W / H = 1 None W / H = 1 / 2 -1~-8 W / H = 1 / 4 -1~-10 W / H = 1 / 8 -1~-12 W / H = 1 / 16 -1~-14
[0179] Among the plurality of intra prediction modes mentioned above, K candidate modes (most probable mode, MPM) can be selected. A candidate list including the selected candidate modes can be generated. An index indicating any one of the candidate modes in the candidate list can be signaled. The intra prediction mode of the current block can be determined based on the candidate mode indicated by the index. For example, the candidate mode indicated by the index can be set as the intra prediction mode of the current block. Alternatively, the intra prediction mode of the current block may be determined based on the value of the candidate mode indicated by the index and a predetermined difference value. The difference value may be defined as the difference between the value of the intra prediction mode of the current block and the value of the candidate mode indicated by the index. The difference value may be signaled via a bitstream. Alternatively, the difference value may be a value pre-defined in the video encoding / decoding device. Alternatively, the intra prediction mode of the current block may be determined based on a flag indicating whether a mode identical to the intra prediction mode of the current block exists in the candidate list. For example, if the flag is a first value, the intra prediction mode of the current block may be determined from the candidate list. In this case, an index indicating any one of the multiple candidate modes belonging to the candidate list may be signaled. The candidate mode indicated by the index may be set as the intra prediction mode of the current block. On the other hand, if the flag is a second value, any one of the remaining intra prediction modes may be set as the intra prediction mode of the current block. The remaining intra prediction mode may refer to a mode among the pre-defined multiple intra prediction modes excluding the candidate mode belonging to the candidate list. If the flag is a second value, an index indicating any one of the remaining intra prediction modes may be signaled.The intra prediction mode indicated by the signaled index can be set to the intra prediction mode of the current block.
[0180] The intra prediction mode of a chroma block can be selected from among multiple intra prediction mode candidates of the chroma block. To this end, index information indicating one of the intra prediction mode candidates of the chroma block can be explicitly encoded and signaled through a bitstream. Table 2 is an example of intra prediction mode candidates of the chroma block.
[0181] Intra-prediction mode candidates for index chroma blocks: Luma Mode: 0 Luma Mode: 50 Luma Mode: 18 Luma Mode: 1 Others 0 6 6 0 0 0 1 5 0 6 6 5 0 5 5 0 2 1 8 1 8 6 6 1 8 1 8 3 1 1 1 6 6 1 4 DM
[0182] In the example of Table 2, DM (Direct Mode) means setting the intra prediction mode of the luminance block located at the same position as the chroma block to the intra prediction mode of the chroma block. Meanwhile, the luminance block located at the same position as the chroma block can be determined based on the position of the top-left sample or the position of the center sample of the chroma block.
[0183] For example, if the intra prediction mode (luminance mode) of the luminance block is 0 (planar mode) and the index points to 2, the intra prediction mode of the chroma block can be determined as horizontal mode (18). For example, if the intra prediction mode (luminance mode) of the luminance block is 1 (DC mode) and the index points to 0, the intra prediction mode of the chroma block can be determined as planner mode (0).
[0184] Consequently, the intra prediction mode of the chroma block may also be set to one of the intra prediction modes shown in FIG. 4 or FIG. 5. The intra prediction mode of the current block may also be used to determine the reference line of the current block, in which case step S310 may be performed before step S300.
[0185] Meanwhile, in the present disclosure, the chroma block may represent at least one of a Cb component block or a Cr component block.
[0186] Referring to FIG. 3, an intra prediction can be performed on the current block based on the reference line of the current block and the intra prediction mode (S320).
[0187] Hereinafter, with reference to FIGS. 6 to 8, we will examine in detail the intra prediction method for each intra prediction mode. However, for the sake of convenience of explanation, it is assumed that a single reference line is used for the intra prediction of the current block, but the intra prediction method described below can be applied in the same or similar way even when multiple reference lines are used.
[0188] FIG. 6 illustrates a planner mode-based intra prediction method according to the present disclosure.
[0189] Referring to FIG. 6, T represents a reference sample located at the upper-right corner of the current block, and L represents a reference sample located at the lower-left corner of the current block. P1 can be generated through horizontal interpolation. For example, P1 can be generated by interpolating T with a reference sample located on the same horizontal line as P1. P2 can be generated through vertical interpolation. For example, P2 can be generated by interpolating L with a reference sample located on the same vertical line as P2. The current sample within the current block can be predicted through the weighted sum of P1 and P2 as shown in the following Equation 1.
[0190]
[0191] In Equation 1, weights α and β can be determined by considering the width and height of the current block. Depending on the width and height of the current block, weights α and β may have the same value or different values. If the width and height of the current block are the same, weights α and β can be set equally, and the predicted sample of the current sample can be set to the average value of P1 and P2. If the width and height of the current block are not the same, weights α and β may have different values. For example, if the width is greater than the height, a smaller value can be set for the weight corresponding to the width of the current block and a larger value can be set for the weight corresponding to the height of the current block. Conversely, if the width is greater than the height, a larger value can be set for the weight corresponding to the width of the current block and a smaller value can be set for the weight corresponding to the height of the current block. Here, the weight corresponding to the width of the current block may be β, and the weight corresponding to the height of the current block may be α.
[0192] FIG. 7 illustrates a DC mode-based intra prediction method according to the present disclosure.
[0193] Referring to FIG. 7, the average value of surrounding samples adjacent to the current block can be calculated, and the calculated average value can be set as the predicted value for all samples within the current block. Here, the surrounding samples may include the top reference sample and the left reference sample of the current block. However, depending on the shape of the current block, the average value may be calculated using only the top reference sample or only the left reference sample. For example, if the width of the current block is greater than the height, the average value may be calculated using only the top reference sample of the current block. Alternatively, if the ratio of the width to the height of the current block is greater than or equal to a predetermined threshold value, the average value may be calculated using only the top reference sample of the current block. Alternatively, if the ratio of the width to the height of the current block is less than or equal to a predetermined threshold value, the average value may be calculated using only the top reference sample of the current block. On the other hand, if the width of the current block is smaller than the height, the average value may be calculated using only the left reference sample of the current block. Alternatively, if the ratio of the width to the height of the current block is less than or equal to a predetermined threshold value, the average value may be calculated using only the left reference sample of the current block. Alternatively, if the ratio of the width to the height of the current block is greater than or equal to a predetermined threshold value, the average value can be calculated using only the left reference sample of the current block.
[0194] FIG. 8 illustrates an intra-prediction method based on a directional mode according to the present disclosure.
[0195] If the intra prediction mode of the current block is a directional mode, projection can be performed on a reference line according to the angle of the directional mode. If a reference sample exists at the projected location, that reference sample can be set as the prediction sample of the current sample. If no reference sample exists at the projected location, a sample corresponding to the projected location can be generated using one or more neighboring samples adjacent to the projected location. For example, a sample corresponding to the projected location can be generated by performing interpolation based on two or more neighboring samples adjacent in both directions relative to the projected location. Alternatively, a single neighboring sample adjacent to the projected location can be set as the sample corresponding to the projected location. In this case, among multiple neighboring samples adjacent to the projected location, the neighboring sample closest to the projected location may be used. The sample corresponding to the projected location can be set as the prediction sample of the current sample.
[0196] Referring to FIG. 8, for the current sample B, if projection is performed to a reference line according to the angle of the intra-prediction mode at that location, a reference sample exists at the projected location (i.e., a reference sample at an integer location, R3). In this case, the reference sample at the projected location can be set as the prediction sample for the current sample B. For the current sample A, if projection is performed to a reference line according to the angle of the intra-prediction mode at that location, a reference sample (i.e., a reference sample at an integer location) does not exist at the projected location. In this case, a sample (r) at a fractional location can be generated by performing interpolation based on neighboring samples (e.g., R2 and R3) adjacent to the projected location. The generated sample (r) at a fractional location can be set as the prediction sample for the current sample A.
[0197] Figure 9 illustrates a method for deriving samples of fractional positions.
[0198] In the example of Fig. 9, the variable h represents the vertical distance (i.e., vertical distance) from the position of predicted sample A to the reference sample line, and the variable w represents the horizontal distance (i.e., horizontal distance) from the position of predicted sample A to the fractional position sample. Additionally, the variable θ represents a predefined angle according to the directionality of the intra-prediction mode, and the variable x represents the fractional position.
[0199] The variable w can be derived as shown in the following mathematical equation 2.
[0200]
[0201] Subsequently, by removing the integer position from the variable w, the fractional position can finally be derived.
[0202] Fractional position samples can be generated by interpolating adjacent integer position reference samples. For example, fractional position reference samples at position x can be generated by interpolating integer position reference samples R2 and integer position reference samples R3.
[0203] In deriving fractional position samples, a scaling factor can be used to avoid real number operations. For example, if the scaling factor f is set to 32, the distance between neighboring integer reference samples can be set to 32 instead of 1, as in the example shown in FIG. 8 (b).
[0204] In addition, the tangent value for the angle θ determined by the directionality of the intra prediction mode can also be scaled up using the same scaling factor (e.g., 32).
[0205] Figures 10 and 11 illustrate tangent values for angles scaled by 32 times for each intra prediction mode.
[0206] Figure 10 shows the scaled result of the tangent value for the non-wide angle intra prediction mode, and Figure 11 shows the scaled result of the tangent value for the wide angle intra prediction mode.
[0207] If the tangent value (tanθ) for the angle value in the intra prediction mode is positive, intra prediction can be performed using only one of the reference samples belonging to the top line of the current block (i.e., top reference samples) or the reference samples belonging to the left line of the current block (i.e., left reference samples). On the other hand, if the tangent value for the angle value in the intra prediction mode is negative, both the reference samples located at the top and the reference samples located at the left are utilized.
[0208] At this time, to simplify the implementation, the left reference samples may be projected upward or the top reference samples may be projected to the left to arrange the reference samples into a 1D array, and intra prediction may be performed using the reference samples in the 1D array.
[0209] FIG. 12 is a diagram illustrating an intra-prediction pattern when the directional mode is one of modes 34 to 49.
[0210] When the intra prediction mode of the current block is one of modes 34 to 49, intra prediction is performed using not only the upper reference samples of the current block but also the left reference samples. At this time, as in the example shown in FIG. 12, the reference samples located on the left side of the current block can be copied to the position of the upper line, or the reference samples located on the left side can be interpolated to generate the reference samples of the upper line.
[0211] For example, if one wishes to obtain a reference sample for position A at the top of the current block, projection can be performed from position A on the top line to the left line of the current block, taking into account the directionality of the intra prediction mode of the current block. If the projected position is denoted as 'a', the value corresponding to position 'a' can be copied, or a fractional position value corresponding to 'a' can be generated and set as the value of position A. For example, if position 'a' is an integer position, the value of position A can be generated by copying the integer position reference sample. On the other hand, if position 'a' is a fractional position, the reference sample located above position 'a' and the reference sample located below position 'a' can be interpolated, and the interpolated value can be set as the value of position A. Meanwhile, the direction of projection from position A at the top of the current block to the left line of the current block may be parallel to the direction of the intra prediction mode of the current block, while being opposite.
[0212] Figure 13 is a diagram illustrating an example of generating an upper reference sample by interpolating left reference samples.
[0213] In Fig. 13, the variable h represents the horizontal distance between position A on the top line and position a on the left line. The variable w represents the vertical distance between position A on the top line and position a on the left line. Additionally, the variable θ represents a predefined angle according to the directionality of the intra prediction mode, and the variable x represents a fractional position.
[0214] The variable h can be derived as shown in the following mathematical equation 3.
[0215]
[0216] Subsequently, by removing the integer position from the variable h, the fractional position can finally be derived.
[0217] In deriving fractional position samples, a scaling factor can be used to avoid real-valued operations. For example, the tangent value for the variable θ can be scaled using a scaling factor f1. Here, since the direction projected to the left line is parallel and opposite to the directional prediction model, the scaled tangent value shown in FIGS. 10 and FIGS. 11 may also be used.
[0218] When a scaling factor f1 is applied, Equation 3 can be modified and used as shown in Equation 4 below.
[0219]
[0220] In the above manner, a 1D reference sample array can be constructed using only the reference samples belonging to the top line. As a result, an intra prediction for the current block can be performed using only the top reference samples constructed as a 1D array.
[0221] Figure 14 shows an example in which intra prediction is performed using reference samples arranged in a 1D array.
[0222] As shown in the example illustrated in Fig. 14, by projecting the left reference samples to generate the top reference samples, the prediction samples of the current block can be obtained using only the reference samples belonging to the top line.
[0223] Contrary to what is shown in FIGS. 12 and 14, a 1D reference sample array may be constructed using only the reference samples belonging to the left line by projecting the top reference sample onto the left line. Specifically, for directional modes 19 through 33 among the directional modes where the tangent value (tanθ) for the angle of the directional mode is negative, the reference samples belonging to the top line may be projected onto the left line to generate the left reference sample.
[0224] The intra prediction mode of the current block can also be derived using reference samples surrounding the current block. Specifically, the gradients for the horizontal and vertical directions of the reference samples are calculated, and the calculated gradients are used to derive the intra prediction mode of the current block.
[0225] Figure 15 is a diagram illustrating an example of setting a reference area.
[0226] For the sake of convenience of explanation, the current block size is assumed to be 4x4.
[0227] A reference area can be set to induce an intra-prediction mode of the current block. For example, in FIG. 15, it is assumed that w0 columns adjacent to the left of the current block and h0 rows adjacent to the top of the current block are set as the reference area.
[0228] The number of columns (w0) and / or rows (h0) constituting the reference region may be fixed in the encoder and decoder. Alternatively, the number of columns (w0) and / or rows (h0) may be determined based on at least one of the size / shape of the current block, whether Intra Sub-Partitioning (ISP) is applied to the current block, or whether the current block is adjacent to a CTU boundary.
[0229] As another example, the size of the reference area may be determined according to the type of filter applied to the reference area. Specifically, the width and height of the filter can be set to the number of columns w0 and the number of rows h0, respectively. For example, assuming that a 3x3 mask as shown in FIG. 17, which will be described later, is used, the number of columns w0 and the number of rows h0 can each be set to 3.
[0230] The reference area may extend beyond the right boundary and / or bottom boundary of the current block. For example, in the example illustrated in FIG. 15, the reference area is shown as extending w1 from the right boundary of the current block and h1 from the bottom boundary of the current block.
[0231] The right extension distance w1 and / or bottom extension distance h1 can be set to be equal to the width and / or height of the current block. For example, if the size of the current block is 4x4, the right extension distance w1 can be set to 4, equal to the width of the current block, and the bottom extension distance h1 can be set to 4, equal to the height of the current block.
[0232] As another example, a reference area can also be set, as in the example shown in FIG. 16.
[0233] Specifically, as in the example illustrated in FIG. 16 (a), the right extension distance w1 and / or the bottom extension distance h1 can be set to 0. Furthermore, as in the example illustrated in FIG. 16 (b), the upper reference area can be formed using only reference samples with x-axis coordinates between 0 and (w-1), and the left reference area can be formed using only reference samples with y-axis coordinates between 0 and (h-1). Here, w represents the width of the current block, and h represents the height of the current block.
[0234] As another example, reference line candidates for intra prediction of the current block or at least one of the reference line candidates may be set as a reference region.
[0235] As another example, depending on whether the current block is adjacent to the CTU boundary, the reference area may be configured using only the top reference area or only the left reference area.
[0236] Filtering (i.e., convolution) using a mask within a reference region can be performed. In this case, the filter used may be at least one of a Sobel mask or a Prewitt mask that outputs a gradient value.
[0237] Figure 17 illustrates the filter coefficients for the Sobel mask and the Prewit mask, respectively.
[0238] Filters of a different type than those shown in FIG. 17 may also be applied to the reference area. For example, instead of a 3x3 square filter, a 1D filter of 1x3 or 3x1, a rectangular filter of 2x3 or 2x3, a cross-shaped filter, or a diamond-shaped filter may be applied to the reference area. Alternatively, filters of a different size than those shown in FIG. 17 (e.g., 2x2, 4x4, or 5x5, etc.) may also be applied to the reference area.
[0239] The type of filter applied to the reference area may be predefined in the encoder and decoder. Alternatively, multiple filter candidates may be predefined, and index information pointing to one of the multiple filter candidates may be encoded and explicitly signaled through the bitstream.
[0240] As another example, at least one of a plurality of filter candidates may be adaptively selected based on at least one of the size / shape of the current block, whether an ISP is applied to the current block, the size of the reference region, the intra-prediction mode of neighboring blocks, or whether the current block touches a CTU boundary. Here, the neighboring blocks may include at least one of the top neighboring block or the left neighboring block of the current block.
[0241] The type of filter applied to the top reference area and the type of filter applied to the left reference area may be different.
[0242] By applying a vertical direction mask to a specific reference sample within a reference region, the vertical direction slope Dy for the reference sample can be obtained. Additionally, by applying a horizontal direction mask to a specific reference sample within a reference region, the horizontal direction slope Dx for the reference sample can be obtained.
[0243] Figure 18 shows the locations where the vertical and horizontal inclinations are obtained within the reference area.
[0244] Assuming that a 3x3 mask is applied as in the example shown in FIG. 18, a vertical slope Dy and a horizontal slope Dx can be obtained for each of the reference samples that are not adjacent to the boundary of the reference region. For example, when w0 and h0 are 3 and w1 and h1 are 4, as in the example shown in FIG. 18, 17 vertical slopes Dy and 17 horizontal slopes Dx can be obtained for each of the 17 reference samples.
[0245] If a filter of a different size or shape than that shown in Fig. 18 is applied, the vertical slope Dy and the horizontal slope Dx can be obtained for more / fewer reference samples than shown.
[0246] Based on the vertical slope Dy and horizontal slope Dx of each reference sample, an intra-prediction mode can be determined for each reference sample.
[0247] We will explain how to determine the intra-prediction mode of a reference sample using the vertical slope Dy and the horizontal slope Dx.
[0248] For example, if either the vertical slope Dy or the horizontal slope Dx is 0, the directional mode of the reference sample can be determined as the horizontal mode (18) or the vertical mode (50). Specifically, if the horizontal slope Dx is 0 and the vertical slope Dy is not 0, the intra-prediction mode of the reference sample can be determined as the vertical mode (50). Conversely, if the vertical slope Dy is 0 and the horizontal slope Dx is not 0, the intra-prediction mode of the reference sample can be determined as the horizontal mode (18).
[0249] If the vertical slope Dy and the horizontal slope Dx are both not zero, one of the remaining directional modes, excluding the horizontal mode and the vertical mode, can be determined as the intra-prediction mode of the reference sample.
[0250] Here, the intra prediction mode group to which the intra prediction mode of the reference sample belongs can be determined by comparing the absolute values of the vertical slope Dy and the horizontal slope Dx. Here, the intra prediction mode group may consist of multiple directional modes of similar directionality.
[0251] Figure 19 shows an example of grouping directional modes into multiple intra-prediction mode groups.
[0252] In FIG. 19, directional modes are exemplified as being classified into four intra-predicted mode groups (a to d) based on the horizontal direction mode (18), diagonal direction mode (34), and vertical direction mode (50).
[0253] 100% of the 2
[0254] In addition, the angles of directional modes 36 through 66 are the same as the angles of modes 2 through 34 transposed.
[0255] If the absolute value of the horizontal slope Dx of a reference sample is greater than the absolute value of the vertical slope Dy, the directional mode of the reference sample may belong to group a or group b.
[0256] Conversely, if the absolute value of the vertical slope Dy of a reference sample is greater than the slope of the horizontal slope Dx, the directional mode of the reference sample may belong to group c or group d.
[0257] Table 3 shows the intra prediction mode groups to which the reference sample's intra prediction mode belongs, depending on the magnitudes of the horizontal slope Dx and the vertical slope Dy.
[0258] if (|Dx| > |Dy|)ElseDx >= 0Dy >= 0bDx >= 0Dy >= 0cDx < 0Dy >= 0aDx < 0Dy >= 0dDx >= 0Dy < 0aDx >= 0Dy < 0dDx < 0Dy < 0bDx < 0Dy < 0c
[0259] Using the horizontal slope Dx and vertical slope Dy of the reference sample, the slope of the directional mode to be assigned to the reference sample can be derived. To this end, a variable R representing the ratio between the horizontal slope and the vertical slope can be derived as shown in Equation 5 below.
[0260]
[0261] As exemplified in Equation 5, the variable R can be derived by using the greater absolute value between the horizontal slope Dx and the vertical slope Dy as the denominator.
[0262] Subsequently, the directional mode of the reference sample can be determined by comparing the variable R with the tangent value (tanθ) for the angle of each directional mode. Specifically, a directional mode having the same tangent value as the variable R or the most similar tangent value can be assigned to the reference sample.
[0263] At this time, if the tangent values for each angle of the directional modes are stored in the encoder and decoder in a scaled state as in the example illustrated in FIG. 10 or FIG. 11, the directional mode of the reference sample can be determined by scaling the variable R using the same scaling factor.
[0264] Next, the amplitude of each of the reference samples can be derived. The amplitude can be derived as the sum of the absolute value of the horizontal slope Dx and the absolute value of the vertical slope Dy, as shown in Equation 6 below.
[0265]
[0266] Next, for each of the intra prediction modes, the amplitude value of each of the reference samples assigned to the same intra prediction mode can be accumulated.
[0267]
[0268] In Equation 7, intra_mode represents an intra-predicted mode. For example, the amplitude accumulation value for a directional mode with mode number N is derived by summing the amplitude values of reference samples assigned to mode N within a reference region, and the amplitude accumulation value for a directional mode with mode number M can be derived by summing the amplitude values of reference samples assigned to mode M within a reference region.
[0269] The buffer storing the amplitude accumulation value can be initialized in blocks. For example, when specifying a reference area around the current block, the amplitude accumulation value for each intra prediction mode can be initialized to 0.
[0270] Through the above process, when a histogram recording the amplitude accumulation values for each intra prediction mode is derived, at least one intra prediction mode can be selected in order of increasing amplitude accumulation values within the histogram. The number of selected intra prediction modes may be M, and M may be a natural number greater than or equal to 1. The value of M may be predefined in the encoder and decoder. Alternatively, the value of M may be adaptively determined by considering at least one of the size / shape of the current block and whether an ISP is applied to the current block. That is, M intra prediction modes may be selected in descending order of amplitude accumulation values.
[0271] At least one intra prediction mode selected from the histogram can be set as the intra prediction mode of the current block, and a prediction block of the current block can be obtained based on the intra prediction mode of the current block. For example, if one intra prediction mode is selected from the histogram, a prediction block obtained based on the selected intra prediction mode can be used as the final prediction block of the current block.
[0272] When multiple intra prediction modes are selected from a histogram, intra prediction can be performed based on each of the multiple intra prediction modes. Accordingly, when multiple prediction blocks are generated, the final prediction block of the current block can be obtained through an average operation or a weighted sum operation of the multiple prediction blocks.
[0273] At this time, for the weighted sum operation, the weights applied to each prediction block can be determined based on the amplitude of the intra prediction mode. That is, among the multiple intra prediction modes, the largest weight can be assigned to the prediction block derived based on the intra prediction mode with the largest amplitude, and the smallest weight can be assigned to the prediction block derived based on the intra prediction mode with the smallest amplitude.
[0274] At this time, the weight assigned to each prediction block can be determined based on the ratio between amplitudes. Alternatively, the values of the weights for each amplitude rank can be stored, and then the weights mapped to the amplitude ranks of the corresponding intra-prediction mode can be applied to the prediction blocks.
[0275] A prediction block for the current block can be obtained by considering at least one default mode along with at least one intra prediction mode selected from the histogram. For example, multiple prediction blocks for the current block can be obtained by performing intra prediction based on each of the intra prediction mode and the default mode selected from the histogram. Subsequently, a final prediction block for the current block can be obtained through an average operation or a weighted sum operation of the multiple prediction blocks.
[0276] The number of default modes N can be an integer greater than or equal to 0 or 1. When M intra prediction modes are selected from the histogram, intra prediction can be performed based on each of the M intra prediction modes and N default modes to obtain (M+N) prediction blocks. Subsequently, the final prediction block of the current block can be obtained through an average operation or a weighted sum operation of the (M+N) prediction blocks.
[0277] The number of default modes N may be predefined in the encoder and decoder. Alternatively, the number of default modes N may be adaptively determined based on at least one of the size / shape of the current block, whether an ISP is applied to the current block, or whether at least one intra-prediction mode selected from the histogram includes a default mode.
[0278] The default mode may include at least one of a planar mode, a DC mode, or a predefined directional mode.
[0279] The encoder and decoder may also be configured to use a predefined mode (e.g., planner mode) among the modes listed above as the default mode.
[0280] Alternatively, the type of default mode may be adaptively determined based on the type of directional mode selected via the histogram. For example, if at least one directional mode selected via the histogram is a vertical mode or a horizontal mode, the planar mode or DC mode may be set as the default mode. On the other hand, if a vertical and / or horizontal mode is not selected via the histogram, the vertical mode or horizontal mode may be set as the default mode.
[0281] Instead of setting the region adjacent to the current block as the reference region, you can also set the reference block indicated by the current block's block vector as the reference region.
[0282] Depending on the shape of the current block, the availability of wide-angle intra prediction modes may be determined. For example, if the current block is a square shape with equal width and height, the directional modes selected from the histogram may consist of non-wide-angle intra prediction modes. On the other hand, if the current block is a non-square shape with different widths and heights, some of the directional modes selected from the histogram may be converted into wide-angle intra prediction modes.
[0283] When performing intra prediction based on an intra prediction mode derived through a histogram, a predefined reference line may be used. Here, the predefined reference line may be an adjacent reference line (i.e., index 0) or a non-adjacent reference line (e.g., index 1) adjacent to the current block.
[0284] Information indicating whether to apply a method of performing intra prediction by selecting an intra prediction mode through the histogram described above can be encoded and signaled through a bitstream. The information may be a 1-bit flag.
[0285] Alternatively, whether to select an intra prediction mode through a histogram can be determined based on at least one of the size / shape of the current block, whether an ISP is applied to the current block, whether the current block touches a CTU boundary, or whether neighboring blocks are encoded with intra prediction.
[0286] For example, if at least one of the top neighbor block or left neighbor block of the current block is not encoded in intra prediction, a method for selecting an intra prediction mode through a histogram can be applied to the current block.
[0287] The method of selecting an intra-prediction mode via a histogram can be applied to both the luminance component and the chroma component. Alternatively, the method described above can be applied only to the luminance component. Or, for each of the luminance component and the chroma component, it may be determined independently whether to select an intra-prediction mode via a histogram.
[0288] The intra prediction mode of the current block can also be derived by utilizing the region surrounding the current block. The surrounding region referenced to derive the intra prediction mode of the current block can be referred to as the reference region.
[0289] FIG. 20 is a drawing illustrating a reference area around the current block.
[0290] In FIG. 20, the width w and height h of the current block are both 4.
[0291] As shown in the example illustrated in FIG. 20, a surrounding area adjacent to the current block can be set as a reference area. Specifically, a left reference area adjacent to the left of the current block and a top reference area adjacent to the top of the current block can be set, respectively.
[0292] The size of the left reference area can be represented by w0, and the size of the top reference area can be represented by h0. For example, w0 represents the number of reference sample lines (i.e., reference sample columns) included in the left reference area, and h0 represents the number of reference sample lines (i.e., reference sample rows) included in the top reference area. In this case, w0 and h0 can each be a natural number greater than or equal to 1. Additionally, w0 and h0 may be predefined in the encoder and decoder.
[0293] For example, as shown in the example illustrated in FIG. 20, if the size of the current block is 4x4 or 2x2, the 4x4 or 2x2 area to the left of the current block can be set as the left reference area, and the 4x4 or 2x2 area to the top of the current block can be set as the top reference area.
[0294] Alternatively, at least one of the size w0 and / or h0 of the reference area may be adaptively determined based on at least one of the size of the current block, the shape of the current block, whether Intra Sub-partitioning (ISP) is applied to the current block, or whether the current block is adjacent to a CTU boundary. Here, the size of the current block represents at least one of the width, height, or product of the width and height of the current block. For example, at least one of the left reference area and the top reference area may be determined to be equal to the size of the current block. Alternatively, the left reference area may be set as a square area with a side length equal to the height of the current block, and the top reference area may be set as a square area with a side length equal to the width of the current block.
[0295] Alternatively, the size of the reference area can be determined by comparing the size of the current block with a threshold value. For example, if the size of the current block is greater than or equal to the threshold value, the size of at least one of the left reference area or the top reference area can be set to 4x4. On the other hand, if the size of the current block is less than the threshold value, the size of at least one of the left reference area or the top reference area can be set to 2x2.
[0296] Alternatively, the size h0 of the top reference area can be determined based on the result of comparing the width of the current block with a threshold value. For example, if the width w of the current block is smaller than the threshold value, the size h0 of the top reference area can be set to 1. On the other hand, if the width w of the current block is larger than the threshold value, the size h0 of the top reference area can be set to 2.
[0297] Similarly, the size w0 of the left reference area can be determined based on the result of comparing the vertical length of the current block with the threshold value.
[0298] Alternatively, conversely to the above, the size w0 of the left reference area may be determined based on the result of comparing the width of the current block with the threshold value, and the size h0 of the top reference area may be determined based on the result of comparing the height of the current block with the threshold value.
[0299] Intra prediction can be performed on a reference region using reference samples from the reference region. Here, reference samples for the left reference region may belong to a column adjacent to the left of the left reference region, and reference samples for the top reference region may belong to a row adjacent to the top of the top reference region.
[0300] In the example illustrated in FIG. 20, w1 and h1 are variables representing the range of reference samples used to perform intra-prediction on a reference region. Specifically, w1 may represent the number of reference samples in the upper-right region of the upper reference region, and h1 may represent the number of reference samples in the lower-left region of the left reference region.
[0301] In the example illustrated in FIG. 20, w1 and h1 are both 4.
[0302] At this time, w1 and h1 may be predefined in the encoder and decoder. For example, w1 and h1 may each be a natural number greater than or equal to 0 or 1.
[0303] Alternatively, at least one of w1 or h1 may be adaptively determined based on at least one of the size of the current block, the shape of the current block, whether Intra Sub-partitioning (ISP) is applied to the current block, or whether the current block is adjacent to a CTU boundary. Here, the size of the current block represents at least one of the width, height, or the product of the width and height of the current block.
[0304] For example, if the current block size (e.g., width or height) is greater than or equal to a threshold value, at least one of w1 or h1 may be set to 8 or 16. On the other hand, if the current block size (e.g., width or height) is less than a threshold value, at least one of w1 or h1 may be set to 4.
[0305] Meanwhile, under the above conditions, w1 can be determined dependently on the width w of the current block, and h1 can be determined dependently on the height h of the current block.
[0306] Alternatively, if the current block is square, w1 and h1 may be identical. On the other hand, if the current block is non-square, w1 and h1 may be different.
[0307] Intra-prediction can be performed on a reference region using reference samples for the reference region. Specifically, after performing intra-prediction on the reference region based on multiple intra-prediction modes, the cost for each prediction result can be calculated.
[0308] Figures 21 and 22 illustrate an example of performing intra prediction on a reference area based on planner mode.
[0309] Specifically, in FIG. 21, reference samples used to perform intra prediction based on planer mode for the left reference area and reference samples used to perform intra prediction based on planer mode for the top reference area are shown.
[0310] As in the example illustrated in FIG. 21, reference samples may be included in the line adjacent to the left of the left reference area and the line adjacent to the top of the top reference area.
[0311] Accordingly, left reference samples for the left reference area are adjacent to the left reference area, whereas top reference samples for the left reference area may not be adjacent to the left reference area.
[0312] Additionally, the top reference samples for the top reference area are adjacent to the top reference area, whereas the left reference samples for the top reference area may not be adjacent to the top reference area.
[0313] Alternatively, as in the example illustrated in FIG. 22, the reference samples for the upper reference area may consist of upper reference samples adjacent to the upper reference area and left reference samples adjacent to the upper reference area, and the reference samples for the left reference area may consist of upper reference samples adjacent to the upper reference area and left reference samples adjacent to the upper reference area.
[0314] Figures 23 and 24 illustrate an example of performing intra prediction on a reference region based on DC mode.
[0315] When intra prediction based on DC mode is performed, the prediction samples can be set as the average value of the reference samples. In this case, as shown in the example illustrated in FIG. 23, the average value for the upper reference area (i.e., DCval) can be calculated using only the upper reference samples adjacent to the upper reference area, and the average value for the left reference area can be calculated using only the left reference samples adjacent to the left reference area.
[0316] Alternatively, as in the example illustrated in FIG. 24, the average value for the upper reference area can be derived using the left reference samples adjacent to the upper reference area together with the upper reference samples adjacent to the upper reference area, and the average value for the left upper reference area can be derived using the upper reference samples adjacent to the left reference area together with the left reference samples adjacent to the left reference area.
[0317] Figures 25 and 26 illustrate an example of performing intra prediction on a reference region based on a directional mode.
[0318] Meanwhile, depending on the directional mode, intra prediction for the reference region can be performed using only the reference samples belonging to the top row of the top reference region, or intra prediction for the reference region can be performed using only the reference samples belonging to the left column of the left reference region.
[0319] For example, FIG. 25 shows an example in which an intra prediction for a reference region is performed using only the reference samples belonging to the top row of the upper reference region.
[0320] For example, if the index of the directional mode is equal to or greater than the index of the top-left diagonal directional mode (i.e., 34), an intra prediction for the reference regions (i.e., the top reference region and the left reference region) can be performed using only the reference samples belonging to the top row of the top reference region. Accordingly, for the top reference region, reference samples adjacent to the top reference region are used, but for the left reference region, reference samples not adjacent to the left reference region may be used.
[0321] Alternatively, as in the example illustrated in FIG. 26, for the upper reference region, intra prediction may be performed using upper reference samples adjacent to the upper reference region, and for the left reference region, intra prediction may be performed using upper reference samples adjacent to the left reference region.
[0322] Meanwhile, if the index of the directional mode is smaller than the index of the vertical mode (i.e., 50), the reference samples belonging to the left column of the left reference area (i.e., left reference samples) can be projected to the top row of the top reference area according to the direction of the directional mode to derive the reference samples belonging to the top row (i.e., top reference samples). Meanwhile, if the position projected from the left reference samples is not an integer position, the left reference samples can be interpolated to obtain the top reference samples.
[0323] Although not explicitly stated, if the index of the directional mode is smaller than the index of the top-left diagonal directional mode, an intra prediction for the reference region (i.e., the top reference region and the left reference region) can be performed using only the reference samples belonging to the left column of the left reference region.
[0324] Meanwhile, if the index of the directional mode is greater than the index of the horizontal directional mode (i.e., 18), the reference samples belonging to the top row of the top reference area (i.e., top reference samples) can be projected to the left column of the left reference area according to the direction of the directional mode to derive the reference samples belonging to the left column (i.e., left reference samples). Meanwhile, if the position projected from the left reference sample is not an integer position, the left reference samples can be interpolated to obtain the top reference sample.
[0325] After performing multiple intra predictions on a reference region based on multiple intra prediction modes, the cost for each intra prediction mode can be calculated. Specifically, the cost for an intra prediction mode can be calculated based on the difference between the reconstructed samples within the reference region and the predicted samples within the reference region obtained through intra prediction.
[0326] Meanwhile, the cost function for calculating the cost may include at least one of SAD (Sum of Absolute Difference), SATD (Sum of Absolute Transformed Differences), SSD (Sum of Squared Difference), or MR-SAD (Mean-Removed Sum of Absolute Differences).
[0327] Once the cost for each intra prediction mode is calculated, the intra prediction mode with the lowest cost can be selected.
[0328] Alternatively, N intra-prediction modes with low costs can be selected. Here, N is a natural number greater than or equal to 1, such as 2, 3, or 4.
[0329] Subsequently, based on N intra prediction modes, N intra predictions are performed on the current block to obtain N prediction blocks. Subsequently, the final prediction block of the current block can be obtained by weighting the N prediction blocks.
[0330] Meanwhile, the weights for the weighted sum can be determined by the ratio of the costs of each intra-prediction mode. That is, if the cost of an intra-prediction mode is low, a high weight may be assigned to the prediction block derived from that intra-prediction mode. Conversely, if the cost of an intra-prediction mode is high, a low weight may be assigned to the prediction block derived from that intra-prediction mode.
[0331] Meanwhile, an intra prediction mode can be induced for each of the upper reference area and the left reference area. For example, based on the results of performing multiple intra predictions on the upper reference area, a first intra prediction mode with the lowest cost can be selected, and based on the results of performing multiple intra predictions on the left reference area, a second intra prediction mode with the lowest cost can be selected. Subsequently, based on the first intra prediction mode and the second intra prediction mode, two intra predictions can be performed on the current block to obtain the first prediction block and the second prediction block. Subsequently, the current block can be obtained by weighting the first prediction block and the second prediction block or averaging them.
[0332] Alternatively, at least one intra prediction mode selected in order of lowest cost may be inserted into the MPM list of the current block. For example, a first intra prediction mode derived from the top reference region and a second intra prediction mode derived from the left reference region may be inserted into the MPM list of the current block.
[0333] Subsequently, at least one of the intra prediction mode candidates included in the MPM list can be selected to perform an intra prediction for the current block.
[0334] Alternatively, for each of the left reference area and the top reference area, the cost for each intra prediction mode can be calculated. Subsequently, the area with the smaller cost among the left reference area and the top reference area can be selected, and the intra prediction mode having the smallest cost in the selected area can be set as the intra prediction mode of the current block. In this case, the cost of each reference area may be derived by summing the costs of the intra prediction modes for that reference area.
[0335] Meanwhile, the number and / or types of intra prediction modes applied to the left reference area and the intra prediction modes applied to the top reference area may be the same or different.
[0336] Alternatively, N intra prediction modes can be selected from the top reference area in order of decreasing cost, and N intra prediction modes can be selected from the left reference area in order of decreasing cost.
[0337] Subsequently, based on 2N intra prediction modes, the cost of 2N intra prediction modes can be calculated again by applying them to the upper reference area and the left reference area. That is, if the initial cost of an intra prediction mode was obtained by applying intra prediction to only one of the left reference area and the upper reference area, the cost of the intra prediction mode in this round can be obtained by applying intra prediction to the left reference area and the upper reference area.
[0338] Afterwards, the intra prediction mode with the smallest cost among 2N intra prediction modes, or M intra prediction modes selected in order of smallest cost, can be used for the intra prediction of the current block.
[0339] Meanwhile, in FIGS. 21 to 26, intra-prediction for a reference region is exemplified as being performed using a single reference sample line adjacent to the reference region. Unlike the illustrated example, intra-prediction for a reference region may also be performed using a reference sample line that is not adjacent to the reference region.
[0340] Specifically, by performing an intra-prediction on a reference region based on each of multiple reference sample lines, the cost can be calculated for each reference sample line. Accordingly, the cost can be calculated for a set combining the intra-prediction mode and the reference sample lines.
[0341] Subsequently, by selecting the combination of the intra prediction mode and reference sample line with the smallest cost, intra prediction for the current block can be performed.
[0342] To encode / decode the intra prediction mode of the current block, a list of intra prediction mode candidates for the current block can be constructed. The intra prediction mode candidate list may be an MPM list or an intra merge list.
[0343] At least one of the following can be inserted into the intra prediction mode candidate list: an intra prediction mode of a neighbor block adjacent to the current block, at least one intra prediction mode selected from a histogram, at least one intra prediction mode with a low cost of performing intra prediction in a reference area, or a predefined intra prediction mode.
[0344] Information indicating whether a candidate identical to the intra prediction mode of the current block is included in the intra prediction mode candidate list can be encoded and signaled. The information may be a 1-bit flag, and the flag may be referred to as the mode prediction flag.
[0345] If the intra prediction mode candidate list includes a candidate identical to the intra prediction mode of the current block, index information indicating the candidate identical to the intra prediction mode of the current block among the candidates included in the intra prediction mode candidate list can be encoded and signaled. The index information may be referred to as the mode prediction index.
[0346] Meanwhile, the candidate with the smallest index in the intra prediction mode candidate list (i.e., the candidate with an index of 0) may be a predefined intra prediction mode. A predefined intra prediction mode may be a planner mode or a DC mode.
[0347] The size N of the intra-prediction mode candidate list may be predefined in the encoder and decoder. Here, the size of the intra-prediction mode candidate list may represent the maximum number of candidates that the intra-prediction mode candidate list can include.
[0348] Alternatively, information indicating the size of the intra-prediction mode candidate list can be encoded and signaled through the upper header.
[0349] For the sake of convenience of explanation, the size N of the intra prediction mode candidate list is assumed to be 6 below.
[0350] If no candidate identical to the intra prediction mode of the current block is included in the intra prediction mode candidate list, the indices of the remaining intra prediction modes (i.e., MN intra prediction modes) can be reassigned, excluding the N candidates included in the intra prediction mode candidate list from among the M intra prediction modes. Here, M may represent the total number of intra prediction modes. For example, following the example of FIG. 4, the total number of intra prediction modes M may be 67. Alternatively, the total number of intra prediction modes M may be determined by including wide-angle intra prediction modes. For example, following the example of FIG. 5, the total number of intra prediction modes M may be 95.
[0351] Information indicating an index reassigned to the same intra prediction mode as the current block among the remaining intra prediction modes can be encoded and signaled. This information may be referred to as the remaining mode index.
[0352] That is, when the mode prediction flag is 1, a mode prediction index indicating one of the candidates included in the intra prediction mode candidate list can be encoded and signaled. On the other hand, when the mode prediction flag is 0, a residual mode index indicating one of the residual intra prediction modes can be encoded and signaled.
[0353] Before encoding / decoding the mode prediction index, information indicating whether the intra prediction mode of the current block is the same as the default mode may be encoded / decoded. The information may be a 1-bit flag, and the flag may be referred to as the default mode flag. The default mode flag may be encoded / decoded when the mode prediction flag is 1.
[0354] The default mode may be predefined in the encoder and decoder. For example, the candidate with the smallest index in the intra-prediction mode candidate list or a predefined intra-prediction mode may be set as the default mode. For example, the default mode may be planner mode.
[0355] If the intra prediction mode of the current block is not the default mode, the intra prediction mode of the current block can be induced through the mode prediction index. Meanwhile, if a candidate with index 0 is set to the default mode, the indices of the remaining candidates, excluding the candidate with index 0, can be reallocated. The mode prediction index can indicate the reallocated index of the candidate identical to the intra prediction mode of the current block.
[0356] Meanwhile, in the case of a color picture, encoding / decoding can be performed for the luminance component and the chroma component, respectively. For example, encoding / decoding can be performed for the luminance component of the current block (i.e., the luminance block), and then encoding / decoding can be performed for the chroma component of the current block (i.e., the chroma block).
[0357] Meanwhile, the size of the chroma block corresponding to the luminance block may vary depending on the color difference format. For example, in a 4:4:4 format, the size of the luminance block and the size of the chroma block may be the same. On the other hand, in a 4:2:0 format, the width and height of the chroma block may be half the size of the width and height of the corresponding luminance block, respectively.
[0358] Meanwhile, predictions for the chroma block can be performed using the restored luminance block. A prediction model using different color components as described above can be called a Cross Component Linear Model (CCLM). When CCLM is applied, the process of deriving the intra prediction mode of the chroma block based on the intra prediction mode of the luminance block can be omitted.
[0359] Figure 27 is a flowchart illustrating a method for predicting a chroma block using a restored luminance block.
[0360] In the embodiments described below, the chroma component of the current block is referred to as the chroma block. Additionally, the luminance component block of the current component or the luminance component block corresponding to the chroma block is referred to as the luminance block. Meanwhile, the current block represents the block to be encoded / decoded at the current time and may be at least one of a coding unit, a prediction unit, or a conversion unit for the luminance component or the chroma component.
[0361] Additionally, unless explicitly stated but limited, embodiments applicable to the current block in this disclosure may be applicable to at least one of the luminar block or the chroma block. That is, the current block may mean at least one of the luminar block or the chroma block. For example, an embodiment related to configuring a template of the current block may be applicable to configuring a template of the luminar block or configuring a template of the chroma block.
[0362] Referring to FIG. 27, first, prediction parameters can be derived for the prediction of the chroma block (S2710). At this time, the prediction parameters can be derived in different ways depending on the image format of the picture. The image format represents the chroma subsampling rate and can be determined as one of 4:4:4, 4:2:2, or 4:2:0.
[0363] If the video format is not 4:4:4, the luma block is downsampled to match the size of the chroma block.
[0364] FIGS. 28 to 30 show examples of downsampling a luma block.
[0365] For the sake of convenience of explanation, the video format is assumed to be 4:2:0.
[0366] When the video format is 4:2:0, as shown in the example illustrated in FIG. 28, the size of the chroma block corresponding to the 4x4 luminance block is 2x2. In this case, a downsampling filter can be applied to the luminance block to reduce the 4x4 luminance block to a 2x2 size. The following Equation 8 represents the application of the downsampling filter.
[0367]
[0368] In Equation 8, Downsampled_Luma represents the sample value within the downsampled luma block, and Luma represents the value of the luma sample before downsampling. For example, Luma[0][0] can represent the position of the top-left sample within the luma block before downsampling. Since the size of the downsampled luma block is 2x2, the variables x and y representing the sample coordinates can each have values ranging from 0 to 1.
[0369] When applying a downsampling filter according to mathematical formula 8, the value of the downsampled luminance sample can be obtained by applying a cross-shaped downsampling filter to the luminance samples. For example, the value of the downsampled luminance sample at the (0, 0) position can be obtained by applying a downsampling filter to the luminance sample at the (0, 0) position, the upper luminance sample at the (0, 0) position, the left luminance sample at the (0, 0) position, the lower luminance sample at the (0, 0) position, and the right luminance sample at the (0, 0) position.
[0370] Downsampling filters of a different shape from those shown in FIG. 29 may also be applied. For example, downsampled luminance samples may be obtained by applying a 1D filter, a rectangular filter, or a square filter. The 1D filter may be 1x3 or 3x1 in size, the rectangular filter may be 2x3 or 3x2 in size, and the square filter may be 2x2 or 3x2 in size.
[0371] The form of the filter may be predefined in the encoder and decoder.
[0372] Alternatively, the shape of the filter may be adaptively determined based on at least one of the current block size / shape, the intra prediction mode applied to the luminance block, whether the location of the chroma sample matches the location of the luminance sample, or the image format.
[0373] Alternatively, information indicating one of multiple filter candidates can be encoded and signaled.
[0374] Alternatively, the filter type may differ depending on the downsampling location. For example, a 1D filter or a rectangular filter may be applied to luminance samples located at the boundary of the luminance block, whereas a cross-shaped filter may be applied to luminance samples not located at the boundary of the luminance block.
[0375] As shown in FIG. 29, a downsampling filter can be applied to locations where both the x-axis and y-axis coordinates are even.
[0376] The application position of the downsampling filter can also be set differently from that shown in Fig. 29.
[0377] Figure 30 shows various examples of application locations for downsampling filters.
[0378] After defining multiple candidates related to the downsampling application location, one of the multiple candidates may be selected. For example, the examples of (a) to (d) in FIG. 30 may be defined as multiple candidates, and then index information pointing to one of the multiple examples may be encoded and signaled.
[0379] Alternatively, one of multiple candidates may be selected based on whether the location of the chroma sample matches the location of the lumina sample.
[0380] A downsampling filter can also be applied to reference samples around the luminance block. Here, the reference samples may represent previously restored samples. Specifically, a downsampling filter can be applied to at least one of the top reference area adjacent to the top of the luminance block or the left reference area adjacent to the left to obtain downsampled luminance reference samples.
[0381] It is possible to obtain a number of downsampled luminance reference samples equal to the number of reference samples included in the reference region of the chroma block.
[0382] Meanwhile, the reference area of the luma block may be referred to as the luma reference area, and the reference area of the chroma block may be referred to as the chroma reference area. The reference area may also be referred to as a tablet.
[0383] The prediction mode between components can be classified into the top component prediction mode, the left component prediction mode, and the top and left component prediction mode, depending on the configuration of the reference area. When the top component prediction mode is selected, the reference area of each Luma Block and Chroma Block consists only of the top restoration area. When the left component prediction mode is selected, the reference area of each Luma Block and Chroma Block consists only of the left restoration area. When the top and left component prediction mode is selected, the reference area of each Luma Block and Chroma Block may consist of the top restoration area and the left restoration area.
[0384] Information indicating which of the top component-to-top prediction mode, the left component-to-top prediction mode, and the top and left component-to-top prediction mode is applied to the current block can be explicitly encoded and signaled. For example, index information indicating the type of the component-to-top prediction mode can be encoded and signaled.
[0385] Alternatively, based on at least one of the size / shape of the current block, whether the current block touches the CTU or picture boundary, or the intra prediction mode applied to the luma block, one of the top component-to-top component prediction mode, the left component-to-top component prediction mode, and the top and left component-to-top component prediction mode may be selected.
[0386] Predictive parameters for a chroma block can be derived using downsampled luminance reference samples and reference samples of the chroma block. The predictive parameters may include weights α and offsets β. The predictive parameters can be derived using the least squares method, etc.
[0387] Alternatively, a weight α offset β can be derived based on the linearity of the maximum and minimum values of downsampled luminance reference samples and the maximum and minimum values of chroma reference samples.
[0388] At this time, the prediction parameters may be derived using only the chroma reference samples at the predefined positions and the corresponding downsampled luminance reference samples. In this case, the process of deriving the prediction parameters is simplified, and the complexity in the encoder and decoder may be reduced. For example, the prediction parameters can be derived using the chroma reference samples at the positions exemplified in the following Equation 9.
[0389]
[0390] In the above example, W and H represent the width and height of the chroma block, respectively. According to the above example, prediction parameters can be derived using four chroma reference samples and their corresponding four downsampled luminance reference samples.
[0391] Predicted parameters may also be obtained using reference samples at locations different from the above example. For example, the locations of the reference samples may be determined as shown in the following Equations 10 and 11.
[0392]
[0393]
[0394] After defining multiple candidates for the locations of the reference samples, one of the multiple candidates can be selected. For example, each of the examples of Equations 9 through 11 listed above can be set as a location candidate, and then the reference samples can be selected according to one of the multiple location candidates.
[0395] Information for selecting one of multiple location candidates can be encoded and signaled. For example, an index pointing to one of multiple location candidates can be encoded and signaled.
[0396] Alternatively, one of a plurality of location candidates may be adaptively selected based on at least one of the size / shape of the current block, the color format, or whether the location of the chroma sample matches the location of the luminance sample.
[0397] For example, if the current block is square, the prediction parameters can be derived using the location candidates of Equation 9. On the other hand, if the current block is non-square, the prediction parameters can be derived using the location candidates of Equation 10 or Equation 11. For example, if the current block is non-square where the width is greater than the height, the location candidates of Equation 10 can be used, and if the current block is non-square where the height is greater than the width, the location candidates of Equation 11 can be used.
[0398] When prediction parameters are derived, a prediction sample of a chroma block can be obtained based on a downsampled luminance sample (S2720). For example, a prediction sample of a chroma block can be obtained according to the following mathematical formula 12.
[0399]
[0400] In Equation 12, PredChroma represents the predicted sample of the chroma block, and Downsampled_Luma represents the downsampled luma sample at the position corresponding to the predicted chroma sample.
[0401] Meanwhile, if the video format is 4:4:4, the downsampling process described above may be omitted. That is, if the video format is 4:4:4, the process of downsampling the restored samples within the luminance block and the process of downsampling the reference samples of the luminance block may be omitted.
[0402] As another example, regardless of the image format, a downsampling filter may not be applied to the reference region of the luminance block. That is, when deriving prediction parameters, instead of using the minimum and maximum values among the downsampled luminance reference samples, the minimum and maximum values among the luminance reference samples may be used.
[0403] Figure 31 is a diagram illustrating the process of performing inter-prediction in the encoder and decoder.
[0404] As shown in the example illustrated in FIG. 31, motion information for the current block can be obtained to perform inter-prediction (S3110). Here, the motion information may 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 may be obtained.
[0405] 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, the encoding / decoding of motion information may be based on a motion information merging mode, a motion vector prediction mode, a template-based motion estimation method, or a two-way matching method, which will be described later.
[0406] In the decoder, movement information of the current block can be derived based on the information transmitted from the encoder.
[0407] Alternatively, motion information of the current block can be derived in the decoder in the same way as in the encoder. This method can be referred to as decoder-side motion estimation.
[0408] When motion information of the current block is derived, a prediction block for the current block can be obtained based on the derived motion information (S3120). 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.
[0409] Below, the process of performing inter-prediction will be explained in more detail.
[0410] The motion information of the current block can be generated through motion estimation.
[0411] Figure 32 shows an example where motion estimation is performed.
[0412] In Fig. 32, it was assumed that the Picture Order Count (POC) of the current picture is T, and the POC of the reference picture is (T-1).
[0413] A search range for motion estimation can be set from the same location as the reference point of the current block within the reference picture. Here, the reference point may be the location of the top-left sample of the current block.
[0414] For example, in FIG. 32, a rectangle of sizes (w0+w1) and (h0+h1) centered on a reference point is exemplified as being set as a search range. In the above example, w0, w1, h0, and h1 may have mutually identical values. Alternatively, at least one of w0, w1, h0, and h1 may be set to have a different value. Or, the sizes of w0, w1, h0, and h1 may be determined so as not to exceed the Coding Tree Unit (CTU) boundary, slice boundary, tile boundary, or picture boundary.
[0415] Within the search range, reference blocks of the same size as the current block can be set, and the cost of each reference block relative to the current block can be measured. The cost can be calculated using the similarity between the two blocks.
[0416] For example, the cost can be calculated based on the sum of the absolute differences between the original samples in the current block and the original samples (or restored samples) in the reference block. The smaller the sum of the absolute values, the lower the cost can be.
[0417] Afterward, the cost of each of the reference blocks is compared, and the reference block with the optimal cost can be set as the prediction block of the current block.
[0418] In addition, 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 a motion vector.
[0419] Furthermore, the index of the picture containing the reference block identified through motion estimation is set as the reference picture index.
[0420] In addition, 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.
[0421] Additionally, motion estimation can be performed for the L0 direction and the L1 direction, respectively. If prediction is performed for both the L0 direction and the L1 direction, motion information for the L0 direction and motion information for the L1 direction can be generated, respectively.
[0422] Figures 33 and 34 show examples in which a predicted block of the current block is generated based on motion information generated through motion estimation.
[0423] Figure 33 shows an example of generating a prediction block with unidirectional (i.e., L0 direction) prediction, and Figure 34 shows an example of generating a prediction block with bidirectional (i.e., L0 and L1 directions) prediction.
[0424] In the case of unidirectional prediction, a prediction block of the current block is generated using a single motion information. For example, the motion information may include an L0 motion vector, an L0 reference picture index, and prediction direction information covering the L0 direction.
[0425] In the case of bidirectional prediction, a prediction block is generated using two sets of motion information. For example, a reference block for the L0 direction, specified based on motion information for the L0 direction (L0 motion information), can be set as the L0 prediction block, and a reference block for the L1 direction, specified based on motion information for the L1 direction (L1 motion information), can be generated as the L1 prediction block. Subsequently, the prediction block of the current block can be generated by performing a weighted sum of the L0 prediction block and the L1 prediction block.
[0426] In the examples illustrated in FIGS. 32 to 34, the L0 reference picture is shown as existing in the direction before the current picture (i.e., having a smaller POC value than the current picture), and the L1 reference picture is shown as existing in the direction after the current picture (i.e., having a larger POC value than the current picture).
[0427] However, unlike the illustrated example, the L0 reference picture may exist in the direction after the current picture, or the L1 reference picture may exist in the direction before the current picture. For example, both the L0 reference picture and the L1 reference picture may exist in the direction before the current picture, or both may exist in the direction after the current picture. Alternatively, bidirectional prediction may be performed using the L0 reference picture existing in the direction after the current picture and the L1 reference picture existing in the direction before the current picture.
[0428] The motion information of the block for which inter-prediction has been performed can be stored in memory. In this case, the motion information can be stored on a sample basis. Specifically, the motion information of the block to which a specific sample belongs can be stored as the motion information of that specific sample. The stored motion information can be used to derive the motion information of neighboring blocks to be encoded / decoded in the future.
[0429] In the encoder, information encoding residual samples corresponding to the difference value between the sample of the current block (i.e., the original sample) and the prediction sample, and motion information necessary to generate the prediction block, can be signaled to the decoder. In the decoder, information regarding the signaled difference value is decoded to derive a difference sample, and a prediction sample within the prediction block generated using the motion information is added to the difference sample to generate a reconstructed sample.
[0430] At this time, one of a plurality of inter-prediction modes may be selected to effectively compress motion information signaled to the decoder. Here, the plurality of inter-prediction modes may include a motion information merging mode and a motion vector prediction mode.
[0431] The motion vector prediction mode is a mode that signals by encoding the difference value between the motion vector and the motion vector prediction value. Here, the motion vector prediction value can be derived based on motion information of surrounding blocks or surrounding samples adjacent to the current block.
[0432] Figure 35 shows the location referenced to derive the motion vector prediction value.
[0433] For the sake of convenience of explanation, the current block is assumed to have a size of 4x4.
[0434] In the illustrated example, 'LB' represents a sample contained in the leftmost column and bottom row within the current block. 'RT' represents a sample contained in the rightmost column and top row within the current block. A0 through A4 represent samples adjacent to the left of the current block, and B0 through B5 represent samples adjacent to the top of the current block. For example, A1 represents a sample adjacent to the left of LB, and B1 represents a sample adjacent to the top of RT.
[0435] Col indicates the location of a sample adjacent to the bottom-right of the current block within the co-located picture. The co-located picture is a picture distinct from the current picture, and information to identify the co-located picture (e.g., 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.
[0436] The motion vector prediction value of the current block can be derived from at least one motion vector prediction candidate included in the Motion Vector Prediction List.
[0437] 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.
[0438] A motion vector stored at the location of a neighbor sample adjacent to the current block, or a scaled motion vector derived by scaling the said motion vector, can be inserted into the motion vector prediction list as a motion vector prediction candidate. At this time, the motion vector prediction candidate can be derived by scanning the neighbor samples adjacent to the current block according to a predefined order.
[0439] For example, it is possible to check whether a motion vector is stored at each location in the order from A0 to A4. Then, according to the above scan order, the first available motion vector found can be inserted into the motion vector prediction list as a motion vector prediction candidate.
[0440] As another example, checking whether a motion vector is stored at each location in the order from A0 to A4 allows the motion vector at the location with the same reference picture as the current block, found first, to be inserted into the motion vector prediction list as a motion vector prediction candidate. If no neighbor sample with the same reference picture as the current block exists, a motion vector prediction candidate can be derived based on the first available vector found. Specifically, the first available motion vector found can be scaled, and the scaled motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate. In this case, scaling can be performed based on the difference in output order between the current picture and the reference picture (i.e., POC difference) and the difference in output order between the current picture and the neighbor sample's reference picture (i.e., POC difference).
[0441] Furthermore, it is possible to check whether a motion vector is stored at each location in the order from B0 to B5. Then, according to the above scan order, the first available motion vector found can be inserted into the motion vector prediction list as a motion vector prediction candidate.
[0442] As another example, checking whether a motion vector is stored at each location in the order from B0 to B5 allows the motion vector at the location with the same reference picture as the current block, found first, to be inserted into the motion vector prediction list as a motion vector prediction candidate. If no neighbor sample with the same reference picture as the current block exists, a motion vector prediction candidate can be derived based on the first available vector found. Specifically, the first available motion vector found can be scaled, and the scaled motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate. In this case, scaling can be performed based on the difference in output order between the current picture and the reference picture (i.e., POC difference) and the difference in output order between the current picture and the neighbor sample's reference picture (i.e., POC difference).
[0443] Alternatively, the scaling process may be skipped during the above steps. In other words, the scaled motion vector may not be inserted into the motion vector prediction list.
[0444] As in the example described above, motion vector prediction candidates can be derived from samples adjacent to the left of the current block, and motion vector prediction candidates can be derived from samples adjacent to the top of the current block.
[0445] In this case, a motion vector prediction candidate derived from the left sample may be inserted into the motion vector prediction list before a motion vector prediction candidate derived from the top sample. In this case, the index assigned to the motion vector prediction candidate derived from the left sample may have a smaller value than that of the motion vector prediction candidate derived from the top sample.
[0446] Conversely, motion vector prediction candidates derived from the top sample may be inserted into the motion vector prediction list before motion vector prediction candidates derived from the left sample.
[0447] Among the motion vector prediction candidates included in the above motion vector prediction list, the motion vector prediction candidate with the highest encoding efficiency can be set as the motion vector prediction value (Motion Vector Predictor, MVP) of the current block. Additionally, index information pointing to the motion vector prediction candidate set as the motion vector prediction value of the current block among multiple motion vector prediction candidates can be encoded and signaled to the decoder. If the number of motion vector prediction candidates is two, the index information may be a 1-bit flag (e.g., an MVP flag). Furthermore, the motion vector difference value (Motion Vector Difference, MVD), which is the difference between the motion vector of the current block and the motion vector prediction value, can be encoded and signaled to the decoder.
[0448] The decoder can construct a motion vector prediction list in the same way as the encoder. Additionally, it can decode index information from the bitstream and select one of multiple 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.
[0449] In addition, the motion vector difference value can be decoded from the bitstream. Subsequently, the motion vector prediction value and the motion vector difference value are combined to derive the motion vector of the current block.
[0450] When bidirectional prediction is applied to the current block, motion vector prediction lists can be generated for both the L0 and L1 directions. That is, the motion vector prediction lists can consist of motion vectors of the same direction. Accordingly, the motion vector of the current block and the motion vector prediction candidates included in the motion vector prediction lists have the same direction.
[0451] When the motion vector prediction mode is selected, the reference picture index and prediction direction information can be explicitly encoded and signaled to the decoder. For example, if multiple reference pictures exist on a reference picture list and motion estimation is performed for each of the multiple reference pictures, a reference picture index for identifying the reference picture from which the motion information of the current block was derived among the multiple reference pictures can be explicitly encoded and signaled to the decoder.
[0452] In this case, if the reference picture list contains only one reference picture, the encoding / decoding of the reference picture index may be omitted.
[0453] The prediction direction information may be an index indicating one of L0 unidirectional prediction, L1 unidirectional prediction, or bidirectional prediction. Alternatively, an L0 flag indicating whether a prediction for the L0 direction is performed and an L1 flag indicating whether a prediction for the L1 direction is performed may be encoded and signaled, respectively.
[0454] The motion information merging mode is a mode that sets the motion information of the current block to be identical to the motion information of neighboring blocks. In the motion information merging mode, motion information can be encoded or decoded using a motion information merging list.
[0455] Motion information merging candidates can be derived based on motion information from neighboring blocks or neighbor samples adjacent to the current block. For example, after defining reference locations around the current block, it is possible to check whether motion information exists at the defined reference locations. If motion information exists at the defined reference locations, the motion information at those locations can be inserted into the motion information merging list as a motion information merging candidate.
[0456] In the example of FIG. 35, the previously defined reference positions may include at least one of A0, A1, B0, B1, B5, and Col. Furthermore, motion information merging candidates can be derived in the order of A1, B1, B0, A0, B5, and Col.
[0457] The motion information of the motion information merge candidate with the optimal cost among the motion information merge candidates included in the motion information merge list can be set as the motion information of the current block. Furthermore, index information (e.g., merge index) pointing to the selected motion information merge candidate among multiple motion information merge candidates can be encoded and transmitted to a decoder.
[0458] In the decoder, a motion information merge list can be configured in the same way as in the encoder. Then, motion information merge candidates can be selected based on the merge index decoded from the bitstream. The motion information of the selected motion information merge candidate can be set as the motion information of the current block.
[0459] Unlike the motion vector prediction list, the motion information merging list consists of a single list regardless of the prediction direction. That is, the motion information merging candidates included in the motion information merging list may have only L0 motion information or L1 motion information, or they may have bidirectional motion information (i.e., L0 motion information and L1 motion information).
[0460]
[0461] Movement information of the current block can also be derived using a restoration sample area around the current block. Here, the restoration sample area used to derive the movement information of the current block may be referred to as a template.
[0462] Figure 36 is a diagram illustrating a template-based motion estimation method.
[0463] In FIG. 32, it was explained that the predicted 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. 32, motion estimation for the current block can be performed based on the cost between a template adjacent to the current block (hereinafter referred to as the current template) and a reference template having the same size and shape as the current template.
[0464] For example, the cost can be calculated based on the sum of the absolute differences between the restored samples in the current template and the restored samples in the reference block. The smaller the sum of the absolute values, the lower the cost can be.
[0465] When a reference template with the optimal cost and the current template within the search range is determined, a reference block adjacent to the reference template can be set as the predicted block of the current block.
[0466] Additionally, movement information of the current block can be set 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.
[0467] Since the template is defined by the previously restored area surrounding the current block, the decoder can perform motion estimation itself 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, except for information indicating whether the template is being used.
[0468] 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. In this case, 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.
[0469] Figure 37 shows examples of template configurations.
[0470] The current template can be configured following one of the examples shown in Fig. 37.
[0471] Alternatively, unlike the example illustrated in FIG. 37, the template may be configured using only the area adjacent to the left of the current block, or only the area adjacent to the top of the current block.
[0472] The size and / or shape of the current template may be predefined in the encoder and decoder.
[0473] Alternatively, multiple template candidates of different sizes and / or shapes can be defined, and index information specifying one of the multiple template candidates can be encoded and signaled to a decoder.
[0474] Alternatively, one of a plurality of template candidates may be adaptively selected based on at least one of the size, shape, or location of the current block. For example, if the current block touches the top boundary of the CTU, the current template may be configured using only the area adjacent to the left of the current block.
[0475] Motion estimation based on a template can be performed for each of the reference pictures stored in the reference picture list. Alternatively, motion estimation can be performed for only some of the reference pictures. For example, motion estimation can be performed only for the reference picture with a reference picture index of 0, or only for reference pictures with a reference picture index smaller than a threshold value, or for reference pictures with a POC difference with the current picture smaller than a threshold value.
[0476] Alternatively, after explicitly encoding and signaling the reference picture index, motion estimation can be performed only on the reference picture pointed to by the reference picture index.
[0477] Alternatively, motion estimation can be performed on a reference picture of a neighbor block corresponding to the current template. For example, if the template consists of a left neighbor area and a top neighbor area, at least one reference picture can be selected using at least one of the reference picture index of the left neighbor block or the reference picture index of the top neighbor block. Subsequently, motion estimation can be performed on the selected at least one reference picture.
[0478] Information indicating whether template-based motion estimation has been applied can be encoded and signaled to a decoder. The information may be a 1-bit flag. For example, if the flag is true (1), it indicates that template-based motion estimation is applied to the L0 and L1 directions of the current block. On the other hand, if the flag is false (0), it indicates that template-based motion estimation is not applied. In this case, motion information of the current block can be derived based on a motion information merging mode or a motion vector prediction mode.
[0479] Conversely to the above, if it is determined that the motion information merging mode and the motion vector prediction mode are not applied to the current block, then a template-based motion estimation may be applied. For example, if a first flag indicating whether the motion information merging mode is applied and a second flag indicating whether the motion vector prediction mode is applied are both 0, then a template-based motion estimation may be performed.
[0480] For each of the L0 and L1 directions, information indicating whether template-based motion estimation has been applied can be signaled. That is, whether template-based motion estimation is applied to the L0 direction and whether it is applied to the L1 direction can be determined independently of each other. Accordingly, while template-based motion estimation is applied to either the L0 or L1 direction, another mode (e.g., motion information merging mode or motion vector prediction mode) may be applied to the other.
[0481] If template-based motion estimation is applied to both the L0 and L1 directions, the prediction block of the current block can be generated based on the weighted sum operation of the L0 prediction block and the L1 prediction block. Alternatively, even if template-based motion estimation is applied to one of the L0 and L1 directions, but another mode is applied to the other, the prediction block of the current block can be generated based on the weighted sum operation of the L0 prediction block and the L1 prediction block.
[0482] Alternatively, a template-based motion estimation method may be inserted as a motion information merging candidate in the motion information merging mode or as a motion vector prediction candidate in the motion vector prediction mode. In this case, whether to apply the template-based motion estimation method may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate points to the template-based motion estimation method.
[0483] Based on the two-way matching method, movement information of the current block can also be generated.
[0484] Figure 38 is a diagram illustrating a motion estimation method based on a two-way matching method.
[0485] The two-way matching method can be performed only when the temporal order of the current picture (i.e., POC) exists between the temporal order of the L0 reference picture and the temporal order of the L1 reference picture.
[0486] When a two-way matching method is applied, a search range can be set for each of the L0 reference picture and the L1 reference picture. In this case, 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.
[0487] As another example, only the L0 reference picture index is encoded and signaled, and an L1 reference picture can be selected based on the distance between the current picture and the L0 reference picture (hereinafter referred to as the L0 POC difference). For example, among the L1 reference pictures included in the L1 reference picture list, an L1 reference picture can be selected in which the 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. If there is no L1 reference picture having an L1 POC difference identical to the L0 POC difference, the L1 reference picture among the L1 reference pictures in which the L1 POC difference is most similar to the L0 POC difference can be selected.
[0488] At this time, among the L1 reference pictures, only L1 reference pictures that have a different temporal direction from the L0 reference picture can be used for two-way 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 with a POC larger than that of the current picture can be selected.
[0489] Conversely to the above, only the L1 reference picture index is encoded and signaled, and the L0 reference picture is selected based on the distance between the current picture and the L1 reference picture.
[0490] Alternatively, a two-way matching method may be performed using the L0 reference picture closest to the current picture among the L0 reference pictures and the L1 reference picture closest to the current picture among the L1 reference pictures.
[0491] Alternatively, a two-way matching method may be performed using an L0 reference picture (e.g., index 0) assigned to a previously defined index in the L0 reference picture list and an L1 reference picture (e.g., index 0) assigned to a previously defined index in the L1 reference picture list.
[0492] Alternatively, LX (X is 0 or 1) reference picture may be selected based on an explicitly signaled reference picture index, and L|X-1| reference picture may be selected as the reference picture closest to the current picture among L|X-1| reference pictures, or as a reference picture having a predefined index within the L|X-1| reference picture list.
[0493] As another example, L0 and / or L1 reference pictures can be selected based on movement information of neighbor blocks of the current block. For example, L0 and / or L1 reference pictures to be used for bidirectional matching can be selected using the reference picture index of the left or top neighbor block of the current block.
[0494] The search range can be set within a predetermined range from the collocated blocks within the reference picture.
[0495] As another example, the search range can be set based on initial movement information. The initial movement information can be derived from the neighbor blocks of the current block. For example, the movement information of the current block's left neighbor block or top neighbor block can be set as the current block's initial movement information.
[0496] When the two-way matching method is applied, the L0 motion vector and the L1 motion vector are set in opposite directions. This indicates that the sign of the L0 motion vector and the L1 motion vector have opposite signs. Additionally, the magnitude 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).
[0497] Subsequently, motion estimation can be performed using the cost between a reference block (hereinafter referred to as the L0 reference block) within the search range of the L0 reference picture and a reference block (hereinafter referred to as the L1 reference block) within the search range of the L1 reference picture.
[0498] If an L0 reference block is selected with a vector (x, y) with respect to the current block, an L1 reference block can be selected at a location spaced (-Dx, -Dy) away from the current block. Here, D can be determined by the ratio of the distance between the current picture and the L0 reference picture to the distance between the L1 reference picture and the current picture.
[0499] For example, in the example illustrated in FIG. 38, 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 mutually identical. Accordingly, in the illustrated example, the L0 motion vector (x0, y0) and the L1 motion vector (x1, y1) have the same magnitude but opposite distances. If the L1 reference picture with POC (T+2) is used, the L1 motion vector (x1, y1) will be set to (-2*x0, -2*y0).
[0500] When the L0 reference block and L1 reference block having the optimal cost are selected, the L0 reference block and L1 reference block can be set as the L0 prediction block and L1 prediction block of the current block, respectively. Subsequently, the final prediction block of the current block can be generated through a weighted sum operation of the L0 reference block and L1 reference block.
[0501] When a two-way matching method is applied, the decoder can perform motion estimation in the same way as the encoder. Accordingly, information indicating whether a two-way motion matching method is applied is explicitly encoded / decoded, while the encoding / decoding of motion information, such as motion vectors, can be omitted. As previously explained, at least one of the L0 reference picture index or the L1 reference picture index may be explicitly encoded / decoded.
[0502] As another example, information indicating whether a two-way matching method has been applied may be explicitly encoded / decoded; if the two-way matching method has been 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 may explicitly encode the smaller of the L0 motion vector and the L1 motion vector.
[0503] Information indicating whether a two-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 two-way matching method is applied to the current block. If the flag is false (e.g., 0), it may indicate that a two-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.
[0504] Conversely to the above, a two-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, if 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 two-way matching method may be applied.
[0505] Alternatively, a two-way matching method may be inserted as a motion information merging candidate in the motion information merging mode or as a motion vector prediction candidate in the motion vector prediction mode. In this case, whether to apply the two-way matching method may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate points to the two-way matching method.
[0506] In the two-way matching method, it was 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 one-way matching method, to which the constraints of the above two-way matching method do not apply, may be applied to generate a predicted block of the current block. Specifically, in the one-way matching method, two reference pictures with a temporal order (i.e., POC) smaller than the current block or two reference pictures with a temporal order larger than the current block may be used. In this case, both of the two 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 from the L1 reference picture list.
[0507] FIG. 39 is a diagram illustrating a motion estimation method based on a unidirectional matching method.
[0508] A unidirectional matching method can be performed based on two reference pictures (i.e., Forward reference pictures) that have a POC smaller than the current picture or two reference pictures (i.e., Backward reference pictures) that have a POC larger than the current picture. In FIG. 39, motion estimation based on a unidirectional matching method is exemplified as being performed based on a first reference picture (T-1) and a second reference picture (T-2) that have a POC smaller than the current picture (T).
[0509] 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 can each be encoded and signaled. At this time, among the two reference pictures used in the unidirectional matching method, the reference picture with a smaller POC difference with the current picture can be set as the first reference picture. Accordingly, when the first reference picture is selected, only reference pictures among the reference pictures included in the reference picture list that have a POC difference with the current picture greater than that of the first reference picture can be set as the second reference picture. The second reference picture index can be set to point to the index of one of the reordered reference pictures after reordering the reference pictures that have the same temporal direction as the first reference picture and have a POC difference with the current picture greater than that of the first reference picture.
[0510] Conversely to the above, the reference picture with the larger POC difference with the current picture among the two reference pictures may be set as the first reference picture. In this case, the index of the second reference picture may be set to point to the index of one of the reordered reference pictures after reordering the reference pictures that have the same temporal direction as the first reference picture and have a smaller POC difference with the current picture than the first reference picture.
[0511] Alternatively, a unidirectional matching method may be performed using a reference picture assigned to a predefined index within the reference picture list and a reference picture having the same temporal direction. For example, a reference picture with an index of 0 within the reference picture list may be set as the first reference picture, and among the reference pictures with the same temporal direction as the first reference picture within the reference picture list, the reference picture with the smallest index may be selected as the second reference picture.
[0512] 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. 39, two L0 reference pictures are shown being used in a 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.
[0513] 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.
[0514] Alternatively, unidirectional matching can be performed using one of the L0 reference picture list and the L1 reference picture list set as the default. Alternatively, two reference pictures can be selected from the L0 reference picture list and the L1 reference picture list that has a larger number of reference pictures.
[0515] Afterwards, a search range can be set within the first reference picture and the second reference picture.
[0516] The search range can be set within a predetermined range from the collocated blocks within the reference picture.
[0517] As another example, the search range can be set based on initial movement information. The initial movement information can be derived from the neighbor blocks of the current block. For example, the movement information of the current block's left neighbor block or top neighbor block can be set as the current block's initial movement information.
[0518] Subsequently, motion estimation can be performed using the cost between the first reference block within the search range of the first reference picture and the second reference block within the search range of the second reference picture.
[0519] At this time, under the unidirectional matching method, the magnitude of the motion vector should be set to increase in proportion to the distance between the current picture and the reference picture. Specifically, if a first reference block is selected with a vector (x, y) with respect to the current picture, the second reference block should be separated 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 to the distance between the current picture and the second reference picture.
[0520] For example, in the example of FIG. 39, the distance between the current picture and the first reference picture (i.e., POC difference) is 1, and the distance between the current picture and the second reference picture (i.e., POC difference) is 2. Accordingly, if 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).
[0521] When a first reference block and a second reference block having optimal costs 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. Subsequently, 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.
[0522] When a unidirectional matching method is applied, the decoder can perform motion estimation in the same way as the encoder. Accordingly, information indicating whether a unidirectional motion matching method is applied is explicitly encoded / decoded, while the encoding / decoding of motion information, such as motion vectors, can be omitted. As previously explained, at least one of the first reference picture index or the second reference picture index may be explicitly encoded / decoded.
[0523] As another example, information indicating whether a unidirectional matching method has been applied may be explicitly encoded / decoded, and if a unidirectional matching method has been applied, a first motion vector or a 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 the one with the smaller magnitude between the first motion vector and the second motion vector.
[0524] Information indicating whether a unidirectional 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 unidirectional matching method is applied to the current block. If the flag is false (e.g., 0), it may indicate that a unidirectional 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.
[0525] Conversely to the above, a unidirectional 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, if 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, a unidirectional matching method may be applied.
[0526] Alternatively, a unidirectional matching method may be inserted as a motion information merging candidate in the motion information merging mode or as a motion vector prediction candidate in the motion vector prediction mode. In this case, whether to apply the unidirectional matching method may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate points to the unidirectional matching method.
[0527] By adjusting the precision of the motion vector, the movement of an object between frames can also be detected. Specifically, the position of each pixel within a picture is specified as an integer. On the other hand, the movement of an object between frames may not be represented by an integer position.
[0528] Considering this, motion vectors can be explored in fractional pixel units by performing interpolation on the reference picture.
[0529] Figures 40 and 41 illustrate examples in which prediction blocks are generated according to the precision of the motion vectors.
[0530] FIG. 40 shows the position of the current block in the current picture, and FIG. 41 illustrates an example in which a predicted block is acquired according to a motion vector.
[0531] Specifically, FIG. 41 (a) shows an example where the motion vector precision is in integer pixel units, and FIG. 41 (b) and (c) show examples where the motion vector precision is in 1 / 2 pixel units and 1 / 4 pixel units, respectively.
[0532] Motion vector precision can also be set in units smaller than those described. For example, motion vector precision can be set in units of 1 / 8 pixel, 1 / 16 pixel, or 1 / 32 pixel.
[0533] 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 Fig. 41 (a).
[0534] On the other hand, when the motion vector of the current block is expressed in fractional units, a reference block composed of fractional position samples can be set as the prediction block of the current block, as in the examples illustrated in FIG. 41 (b) and (c). In this case, the fractional position samples within the reference block can be generated by interpolating integer position samples. The interpolation filter can have a size of 4 taps or 8 taps.
[0535] As another example, to reduce complexity, fractional position samples can be generated through linear interpolation using only integer position samples adjacent to the fractional position.
[0536] Information indicating the motion vector precision of the current block can be encoded and signaled. For example, after assigning different indices to each of multiple 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.
[0537] At this time, the number and / or types of available motion vector candidates may 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 may 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.
[0538] An index indicating one of the motion vector candidates available for the current block can 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 can be determined.
[0539] By adjusting the precision of the motion vector, the motion vector can be explored more precisely, and accordingly, the prediction accuracy for the current block can be improved.
[0540] Meanwhile, motion vectors expressed as fractional positions can be scaled up to integers and encoded.
[0541] Compensation for the movement of an object may be performed based on at least one of a translation model to compensate for linear movement of the object (e.g., movement in the horizontal and / or vertical directions), a zooming model to compensate for changes in the size of the object, and a rotation model to compensate for rotational movement of the object. Here, zooming may refer to enlargement or reduction in size.
[0542] FIG. 42 shows an example in which motion compensation based on a translational model and a zooming model is performed for the current block.
[0543] For the convenience of explanation, the current block is assumed to have a size of 4x4, as shown in FIG. 40.
[0544] In FIG. 42, the variable α represents the scaling parameter. The size of the reference block can be derived by multiplying the size of the current block by the variable α.
[0545] A scaling parameter α less than 1 indicates that the reference block is smaller than the current block, and a scaling parameter α greater than 1 indicates that the reference block is larger than the current block.
[0546] Figures 42 (a) and (b) show examples where the scaling parameter α is less than 1, and Figure 42 (c) shows an example where the scaling parameter α is greater than 1.
[0547] Based on the motion vector of the current block, the top-left position of the reference block can be determined. Specifically, the top-left position of the reference block can be set to a position offset by the motion vector from the position corresponding to the top-left sample of the current block within the reference picture. Subsequently, a reference block can be set such that its width and height are each α times the width and height of the current block, respectively, according to a scaling parameter. Fractional position samples within the reference block can be generated by interpolating integer position samples.
[0548] The reference block derived by the motion vector and scaling parameter can be set as the prediction block of the current block.
[0549] Meanwhile, information regarding the size adjustment parameter α can be encoded and signaled. Specifically, a different index is assigned to each of the multiple size adjustment parameter candidates, and an index specifying the size adjustment parameter candidate applied to the current block can be encoded and signaled.
[0550] Alternatively, the size adjustment parameter of the current block may be derived based on the size adjustment parameter of a neighbor block. For example, the size adjustment parameter of a neighbor block at a predefined location can be set as the size adjustment parameter of the current block.
[0551] Alternatively, when multiple neighbor blocks are searched sequentially, the size adjustment parameter of the first available neighbor block found can be set as the size adjustment parameter of the current block.
[0552] Alternatively, a size control parameter of a neighboring block can be set as a size control parameter candidate. In this case, a list of size control parameter candidates containing multiple size control parameter candidates can be generated by sequentially searching multiple neighboring blocks. One of the multiple size control parameter candidates included in the list of multiple size control parameter candidates can be set as the size control parameter of the current block. In this case, an index indicating a candidate among the multiple size control parameter candidates that is identical to the size control parameter of the current block can be encoded and signaled.
[0553] Meanwhile, the neighbor blocks used to derive the size adjustment parameters of the current block may include at least one of the top neighbor block, left neighbor block, top-left neighbor block, top-right neighbor block, or bottom-left neighbor block.
[0554] FIG. 43 shows an example in which motion compensation based on a translational model and a rotational model is performed for the current block.
[0555] For the convenience of explanation, the current block is assumed to have a size of 4x4, as shown in FIG. 40.
[0556] First, as shown in the example illustrated in FIG. 43 (a), the position of a temporary block within a reference picture can be determined based on the motion vector of the current block. Specifically, a block position can be determined by taking a position spaced apart by the motion vector from the position corresponding to the top-left sample of the current block within the reference picture as the top-left sample.
[0557] Afterwards, the temporary block can be rotated as in the example shown in FIG. 43 (b). 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.
[0558] Meanwhile, a rotation matrix may be used when rotating a temporary block specified by a motion vector. That is, the predicted sample for the current block can be set to a sample at a position obtained by applying a rotation matrix to the sample position within the temporary block.
[0559] Mathematical equation 13 represents the rotation matrix.
[0560]
[0561] In the above mathematical equation 13, (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 the target sample to be predicted within the current block.
[0562] (pos_x', pos_y') represents the position rotated from the position of the sample within the temporary block, and θ represents the rotation angle.
[0563] The sample value at position (pos_x', pos_y') within the reference picture can be set as the value of the predicted sample for the position of the sample to be predicted. If position (pos_x', pos_y') is a fractional position, the sample at that position can be generated by interpolating integer position samples.
[0564] Meanwhile, information representing the rotation angle θ can be encoded and signaled. For example, after assigning different indices 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.
[0565] Alternatively, the rotation angle of the current block can be derived based on the rotation angle of a neighbor block. For example, the rotation angle of a neighbor block at a predefined position can be set as the rotation angle of the current block.
[0566] Alternatively, when multiple neighbor blocks are searched sequentially, the rotation angle of the first available neighbor block found can be set as the rotation angle of the current block.
[0567] Alternatively, the rotation angle of a neighboring block can be set as a rotation angle candidate. In this case, a rotation angle candidate list containing multiple rotation angle candidates can be generated by sequentially searching multiple neighboring blocks. One of the multiple rotation angle candidates included in the list of multiple rotation angle candidates can be set as the rotation angle of the current block. In this case, an index indicating the candidate among the multiple rotation angle candidates that is identical to the rotation angle of the current block can be encoded and signaled.
[0568] Meanwhile, the neighbor block used to induce the rotation angle of the current block may include at least one of the top neighbor block, left neighbor block, top-left neighbor block, top-right neighbor block, or bottom-left neighbor block.
[0569] Although not explicitly stated, motion compensation for the current block can also be performed by simultaneously applying translational, zooming, and rotational models.
[0570] 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.
[0571] For example, the number and / or types of motion vector precision candidates available for the current block may differ between the case where only a translation model is applied and the case where at least one of a zooming model or a rotation model is applied.
[0572] As a specific example, when a translation model is applied to the current block, candidates of at least 1 / 4 pixel unit may be available for the current block. On the other hand, when at least one of a zooming model or a rotation model is additionally applied along with the translation model to the current block, candidates of at least 1 / 16 pixel unit may be available for the current block.
[0573] Alternatively, if a translation 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 rotation model is additionally applied to the current block along with the translation model, the motion vector precision of the current block may be set to 1 / 16 pixel units.
[0574] Meanwhile, available motion vector precision or available motion vector precision candidates for each motion compensation model may be stored in the encoder and decoder. Alternatively, information representing available motion vector precision or available motion vector precision candidates for each motion compensation model may be encoded and signaled through an upper header.
[0575] Motion compensation for an affine model, to which a zooming model and / or a rotation model are added to a translation model, can be performed using the motion vector of a control point. Here, the control point may correspond to a corner of the current block. For example, to perform motion compensation based on an affine model, at least one of the motion vector of the top-left corner, the motion vector of the top-right corner, or the motion vector of the bottom-left corner may be used.
[0576] Hereinafter, the motion vector of a control point will be referred to as the control point motion vector.
[0577] Figures 44 and 45 show an example of generating a prediction block for the current block using control point motion vectors.
[0578] For the convenience of explanation, the current block is assumed to have a size of 4x4, as shown in FIG. 40.
[0579] In FIG. 44 (a) and (b), a prediction block for the current block is exemplified by the motion vector of the first control point corresponding to the top-left corner of the current block (first control point motion vector, A) and the motion vector of the second control point corresponding to the top-right corner of the current block (second control point motion vector, B).
[0580] Beyond the illustrated examples, it is also possible to derive the predicted block of the current block by additionally utilizing the motion vector of the bottom-left corner or by using the motion vector of the bottom-left corner instead of the top-right corner.
[0581] Figure 46 shows an example of generating a prediction block for the current block using three control point motion vectors.
[0582] In FIG. 46 (a) and (b), a prediction block for the current block is exemplified by the motion vector of the first control point corresponding to the upper-left corner of the current block (first control point motion vector, A), the motion vector of the second control point corresponding to the upper-right corner of the current block (second control point motion vector, B), and the motion vector of the third control point corresponding to the lower-left corner of the current block (third control point motion vector, C).
[0583] As shown in the examples illustrated in FIGS. 44 to 46, translation, zooming, and rotational movement compensation for the current block can be performed using two or three control point movement vectors.
[0584] Information indicating the number of control point motion vectors can be encoded and signaled. The information can be signaled in blocks. For example, the information can indicate whether two control point motion vectors or three control point motion vectors are used in the current block.
[0585] 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.
[0586] 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 to be equal to the number of control point motion vectors of neighboring blocks.
[0587] Using control point motion vectors, sample-specific motion vectors within the current block can be derived. Equation 14 represents a formula for deriving a motion vector for each sample using two control point motion vectors.
[0588]
[0589] In the above mathematical formula 14, (mv x , mv y ) represents the motion vector at the (x, y) position within the current block. (mv Ax , mv Ay ) represents the first control point motion vector (A), and (mv Bx , mv By ) represents the second control point motion vector (B). W represents the width of the current block.
[0590] When three control point motion vectors are used, a motion vector per sample can be derived by the following mathematical formula 15.
[0591]
[0592] In the above mathematical formula 15, (mv Cx , mv Cy ) represents the third control point motion vector (C).
[0593] When motion vectors are derived for each sample, motion compensation can be performed for each sample, as in the example illustrated in FIG. 45. Specifically, a reference sample indicated by the motion vector of the sample to be predicted can be set as a prediction sample for the sample to be predicted.
[0594] Meanwhile, if the motion vector of the sample to be predicted 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 sample to be predicted.
[0595] At this time, the precision of the motion vector for each sample may differ. 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.
[0596] In this case, fractional position samples 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 prediction samples 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 1 / 4 pixel increments.
[0597] The reference motion vector precision can be determined in block units. Alternatively, the precision of the control point motion vectors can be set to the reference motion vector precision. Alternatively, the reference motion vector precision may be predefined in the encoder and decoder.
[0598] As another example, to reduce complexity, motion vectors can be derived at the sub-block level.
[0599] Figure 47 shows an example in which motion vectors are derived in sub-block units.
[0600] The size and / or shape of the sub-block may be predefined in the encoder and decoder. For example, the sub-block may be a square block of size 2x2 or 4x4.
[0601] 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. Conversely, if the current block is non-square, the sub-block may also be non-square.
[0602] Alternatively, information regarding at least one of the partitioning method or partitioning form of the current block may be explicitly encoded and signaled. For example, information regarding at least one of the size of a sub-block, the shape of a sub-block, the location of a partition line dividing the current block, or the number of partition lines may be explicitly encoded and signaled. The information may be encoded and signaled on a block-by-block basis, or it may be encoded and signaled through an upper header.
[0603] In Fig. 47, it was assumed that the sub-block is a square block of size 2x2.
[0604] The motion vector of a sub-block can be derived using the coordinates of a predefined location within the sub-block. Here, the predefined location may be one of the location of the top-left sample, the top-right sample, the bottom-left sample, the bottom-right sample, or the center location within the sub-block.
[0605] By substituting the coordinates of a predefined position within the sub-block into (x, y) of Equation 14, the motion vector of the sub-block can be derived.
[0606] As in the example described above, motion vectors can be derived in sub-block units based on an affine motion model.
[0607] Meanwhile, motion vectors can also be derived in sub-block units using collocated pictures. As described above, deriving motion vectors in sub-block units using collocated pictures can be referred to as SbTMVP (Sub-block Temporal Motion Vector Prediction).
[0608] A collocated picture may be one of the reference pictures included in the reference picture list. For example, a picture with index 0 in the reference picture list may be selected as the collocated picture.
[0609] Alternatively, information indicating the index of a reference picture set as a collocated picture within the reference picture list may be explicitly encoded and signaled.
[0610] Figures 48 and 49 show examples in which motion vectors are induced in units of sub-blocks within the current block when SbTMVP is applied.
[0611] The size and / or shape of the sub-block may be predefined in the encoder and decoder.
[0612] Alternatively, the size and / or shape of the sub-block may be adaptively determined according to the size and / or shape of the current block. For example, if at least one of the width or height of the current block is greater than a threshold value, the size of the sub-block may be set to 8x8. Otherwise, the size of the sub-block may be set to 4x4.
[0613] Alternatively, information indicating the size and / or shape of the sub-block may be explicitly encoded and signaled.
[0614] In the example illustrated in FIG. 48, it is assumed that the current block size is 16x16 and the sub-block size is 4x4.
[0615] When SbTMVP is applied, the initial motion vector of the 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 difference value to the motion vector prediction candidate indicated by the index. Meanwhile, the motion vector difference value can also be explicitly encoded and signaled.
[0616] Alternatively, the encoding of the index may be omitted, and a motion vector prediction candidate with a predefined index within the motion vector prediction list may be set as the prediction value for the initial motion vector. Here, the motion vector prediction candidate with a predefined index may be a motion vector prediction candidate with an index of 0 or a motion vector prediction candidate with the largest index.
[0617] Alternatively, an index indicating one of the motion information merge candidates included in the motion information merge list may be encoded and signaled. The initial motion vector may be set to be identical to the motion vector of the motion information merge candidate indicated by the index.
[0618] Alternatively, the encoding of the index can be omitted, and an initial motion vector can be derived based on a motion information merging candidate having a predefined index within the motion information merging list. Here, the motion information merging candidate having a predefined index may be a motion information merging candidate with an index of 0 or a motion information merging candidate with the largest index.
[0619] Alternatively, an initial motion vector can be derived using the motion vector of a neighbor block at a predefined position. Here, the neighbor block at the predefined position may be a left neighbor block or an top neighbor block.
[0620] The motion vector of a neighbor block at a predefined position can be set as the predicted value of the initial motion vector, and the initial motion vector can be derived by adding a difference value to the predicted value.
[0621] Alternatively, the motion vector of a neighbor block at a predefined position can be set as the initial motion vector.
[0622] Alternatively, the initial motion vector can be derived using a template-based motion estimation method (i.e., a template matching method) or two-way matching.
[0623] 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.
[0624] Alternatively, information indicating the precision of the initial motion vector may be explicitly encoded and signaled. The information may be an index indicating one of a plurality of motion vector precision candidates.
[0625] When deriving an initial motion vector using motion vector prediction candidates, 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 candidates to match the motion vector precision of the initial motion vector, the adjusted initial motion vector prediction candidates can be inserted into the motion vector prediction list.
[0626] When deriving initial motion vectors using motion information merging candidates, motion information merging candidates can be derived based on the motion vector precision of the initial motion vectors. That is, after adjusting the motion information merging candidates according to the motion vector precision of the initial motion vectors, the adjusted initial motion information merging candidates can be inserted into the motion information merging list.
[0627] Meanwhile, among the motion information merging candidates included in the motion information merging list, only those candidates whose reference picture is identical to the collocated picture of the current block can be used to derive the initial motion vector. That is, if the reference picture of a motion information merging candidate is different from the collocated picture of the current block, the initial motion vector may not be derived from that motion information merging candidate.
[0628] If there are multiple candidates among the motion information merging candidates for which the reference picture is identical to the collocated picture of the current block, an index indicating one of the multiple candidates can be encoded and signaled. Alternatively, if there are multiple candidates among the motion information merging candidates for which the reference picture is identical to the collocated picture of the current block, an initial motion vector can be derived from the candidate with the smallest index or the candidate with the largest index among the multiple candidates.
[0629] If 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 is selected according to a preset priority, and an initial motion vector can be derived from the selected motion information.
[0630] The priority can be determined based on at least one of the magnitude of the motion vector of the motion merge candidate, the index of the reference picture of the motion merge candidate, or whether the reference picture of the motion merge candidate is the same as the collocated picture.
[0631] Alternatively, it may be set to always derive an initial motion vector based on motion information in the L0 direction.
[0632] When initial motion vectors are derived based on a template matching method, motion estimation can be performed according to the precision of the initial motion vectors. For example, if the precision of the initial motion vectors is in the integer pixel unit, motion estimation based on template matching can also be performed only at integer locations.
[0633] Similarly, when an initial motion vector is derived based on two-way matching, motion estimation can be performed according to the precision of the initial motion vector.
[0634] Meanwhile, as a result of the two-way 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, according to a pre-set priority, one of the L0 motion vector and the L1 motion vector can be set as the initial motion vector.
[0635] Alternatively, it may be set to always derive an initial motion vector based on motion information in the L0 direction.
[0636] Alternatively, information indicating which of the L0 motion vector and L1 motion vector is set as the initial motion vector may be encoded and signaled.
[0637] Once an initial motion vector is derived, the position of a collocated block within a collocated picture can be determined using the initial motion vector. For example, a block located at a position offset by the initial motion vector from a position corresponding to the current block within a reference picture can be set as the collocated block. In this case, the position of the collocated block can be determined based on a predefined position within the current block. Here, the predefined position may be the top-left position, top-right position, bottom-left position, bottom-right position, or center position.
[0638] Depending on the division method of the current block, the collocated block can be divided into multiple collocated sub-blocks. Additionally, the motion vector of each collocated sub-block within the collocated block can be set as the motion vector of each sub-block within the current block.
[0639] As another example, the positions of collocated sub-blocks corresponding to each of the sub-blocks within the current block in the collocated picture can be determined using initial motion vectors. In this case, the positions of the collocated sub-blocks can be derived based on predefined positions within the sub-blocks. Here, the predefined positions may be the top-left, top-right, bottom-left, bottom-right, or center positions.
[0640] Subsequently, 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.
[0641] 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 may be a zero vector (i.e., (0, 0)) or an initial motion vector.
[0642] Alternatively, if the motion information of the collocated sub-block corresponding to the sub-block is unavailable, the motion vector of the sub-block may be derived from another location within the collocated sub-block.
[0643] Specifically, when a position corresponding to a predefined position within a collocated sub-block is encoded by intra-prediction, there is no motion vector at that position. For example, if a predefined position is assumed to be a central position (e.g., c10 in FIG. 49), and no motion vector is stored at the central position, the motion vector of the sub-block cannot be derived.
[0644] In this case, the motion vector of the sub-block can be derived based on the motion vector stored at a location different from the center position. Specifically, the motion vector of the sub-block can be derived from the motion vector stored at a location adjacent to the center position (e.g., top adjacent position c6, left adjacent position c9, or top-left adjacent position c5).
[0645] Alternatively, if the center location is unavailable, samples within the collocated sub-block may be searched according to the scan order, and the first available motion vector found may be set as the motion vector of the sub-block. Here, the scan order may be a horizontal scan, a vertical scan, a diagonal scan, or a raster scan.
[0646] Alternatively, if the motion information of the collocated sub-block is unavailable, the motion vector of the sub-block can be set as the motion vector of the collocated block. For example, the motion vector stored at a position corresponding to a previously defined position within the current block within the collocated block can be set as the motion vector of the sub-block.
[0647] As in the example described above, motion vectors can be derived in sub-block units using an affine motion model or SbTMVP. When motion vectors are derived in sub-block units, motion compensation can be performed for each sub-block based on the motion vector of each sub-block.
[0648] 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 may be composed of prediction samples for each of the sub-blocks.
[0649] When detecting movement between frames, the precision of the motion vector can be adjusted. Specifically, the position of each sample within a picture is defined as an integer position. However, the position reflecting the movement can be a real number rather than an integer position.
[0650] Considering this, motion vectors can be explored more precisely through reference picture interpolation.
[0651] Figures 50 and 51 are diagrams illustrating examples in which a prediction block is derived according to the precision of the motion vector.
[0652] FIG. 50 shows the position of the current block in the current picture, and FIG. 51 shows the position of the reference block according to the motion vector precision.
[0653] As in the example illustrated in FIGS. 50 and 51, the motion vector of the current block can be defined as the distance from a sample corresponding to the top-left position of the current block in the reference picture to a sample corresponding to the top-left position of the reference block in the reference picture.
[0654] FIG. 51 (a) illustrates the case where the motion vector precision of the current block is an integer Pel, FIG. 51 (b) illustrates the case where the motion vector precision of the current block is 1 / 2 Pel. Also, FIG. 51 (c) illustrates the case where the motion vector precision of the current block is 1 / 4 Pel.
[0655] In Fig. 51, the vector precision is expressed up to 1 / 4, but the motion vector can be expressed with even greater precision, such as 1 / 8, 1 / 16, or 1 / 32.
[0656] 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 the index of the motion vector precision candidate applied to the current block.
[0657] By adjusting the precision of the motion vectors used for cross-frame prediction, more precise motion vector detection may be possible. If the reference block indicated by the motion vector exists at a real-valued location, the samples at the real-valued location can be generated using samples at integer locations and an interpolation filter. Additionally, motion vectors represented by real numbers can be scaled up to integers for encoding / decoding.
[0658] Thus, the motion vector (MV), motion vector predicted value (MVP), and motion vector difference value (MVD) can be encoded / decoded into integer values through integerization. Specifically, the motion vector, motion vector predicted value, and / or motion vector difference value can be integerized based on the motion vector precision.
[0659] For example, if the motion vector precision is 1 / N, the motion vector difference value MVD can be converted to an integer by multiplying it by N. For example, if the motion vector difference value MVD is (4 / 16, 8 / 16), the motion vector difference value MVD can be converted to an integer by multiplying it by 16. That is, the converted motion vector difference value MVD can be expressed as (4, 8).
[0660] Based on motion vector precision, the actual MVD can be derived from the integerized MVD. For example, if the motion vector precision is 1 / N, the actual MVD can be derived by dividing the integerized MVD by N. 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). Or, if the integerized MVD is (4, 8) and the motion vector precision is 1 / 4, the actual MVD can be (4 / 4, 8 / 4).
[0661] Depending on the motion vector precision, the range of representation of the integerized MVD may differ. For example, assume that the motion vector difference value 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).
[0662] Comparing the two cases above, if the motion vector precision is adjusted from 1 / 16 to 1 / 4, the value of the integerized MVD can be reduced from (4, 8) to (1, 2).
[0663] Consequently, depending on the motion vector precision, the number of bits required to encode / decode the integerized motion vector difference value MVD may vary. Accordingly, a motion vector precision that minimizes the number of bins can be selected when encoding / decoding the motion vector difference value MVD. Then, based on the selected motion vector precision, the motion vector difference value MVD can be converted to an integer, and the integerized motion vector difference value MVD can be encoded / decoded. In addition, information regarding the motion vector precision can be additionally encoded / decoded.
[0664] In the decoder, the actual MVD can be restored from the decoded MVD based on motion vector precision. Then, the motion vector MV can be derived by combining the restored MVD and the motion vector prediction value MVP.
[0665] As described above, adjusting the value of the motion vector difference value MVD, which is encoded / decoded based on motion vector precision, is called the AMVR (Adaptive Motion Vector Resolution) method.
[0666] Figures 52 and 53 are diagrams illustrating the process of encoding and decoding motion vector difference values when the AMVR method is applied, respectively.
[0667] For the sake of convenience of explanation, it is assumed that the motion vector and the motion vector difference value are expressed in units of 1 / 16 before integerization is performed, and 1 / 16 is referred to as the original motion vector precision.
[0668] The motion vector difference value MVD can be derived by differencing the motion vector prediction value MVP from the motion vector MV (S5210).
[0669] The motion vector difference value MVD may consist of a horizontal component (i.e., the x-axis component) and a vertical component (i.e., the y-axis component).
[0670] When the motion vector difference value is 0, that is, when both the horizontal and vertical components are 0, the value of the motion vector difference value MVD to be encoded becomes 0 regardless of the motion vector precision. Therefore, when the motion vector difference value MVD is 0, the encoding of AMVR-related information can be omitted (S5220).
[0671] On the other hand, if the motion vector difference value is not zero, that is, if at least one of the horizontal component and the vertical component is not zero, the motion vector precision can be determined (S5230). Meanwhile, the motion vector precision can be encoded as AMVR-related information.
[0672] 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 if the AMVR method is applied.
[0673] If the AMVR method is not applied to the current block, the motion vector precision can be set to a 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.
[0674] When the AMVR method is applied to the current block, an index indicating one of multiple motion vector precision candidates, i.e., amvr_prec_idx, may be additionally decoded. In this case, amvr_flag is 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, multiple 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 multiple motion vector precision candidates indicated by the index. That is, if the motion vector precision of the current block is the default value, it is encoded and signaled as 0, which is the value of amvr_flag, and the encoding of amvr_prec_idx may be omitted.
[0675] In the encoder, the optimal motion vector precision can be determined by performing Rate Distortion Optimization (RDO) for each combination of amvr_flag and amvr_prec_idx. That is, by performing RDO for the following cases, the combination with the optimal cost can be selected.
[0676] 1) When amvr_flag is 0
[0677] 2) When amvr_flag is 1 and amvr_prec_idx is 0
[0678] 3) When amvr_flag is 1 and amvr_prec_idx is 1
[0679] 4) When amvr_flag is 1 and amvr_prec_idx is 2
[0680] Depending on the motion vector precision of the current block, a variable for scaling the motion vector difference value, i.e., a scaling parameter, can be set. For example, Table 4 shows the values of the variable amvrshift according to the motion vector precision.
[0681] amvr_flagamvr_prec_idxamvrshift0 (1 / 4)-210 (1 / 2)311 (1-pel)412 (4-pel)6
[0682] If the finest motion vector precision applicable to the current block is 1 / 16, the motion vector precision can be expressed as in the following mathematical formula 16.
[0683]
[0684] As shown in Table 4, 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 16.
[0685] When the value of amvr_flag is 1, the variable amvrshift 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 Equation 16.
[0686] In the encoder, the motion vector difference value MVD can be scaled down and encoded using the variable amvrshift, which is based on the motion vector precision. As an example, Equation 17 shows an example in which a scale-down operation is performed on the motion vector difference value MVD.
[0687]
[0688] In the above mathematical formula 17, MVD_x represents the horizontal component of the motion vector difference value, and MVD_y represents the vertical component of the motion vector difference value. MVD'_x and MVD'_y represent the results of performing a scale-down operation.
[0689] The encoder can encode motion vector difference values and AMVR information with changed precision (S5240).
[0690] In the decoder, the motion vector difference value MVD can be decoded (S5310).
[0691] If the motion vector difference value is 0, the 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 (S5320).
[0692] On the other hand, if the motion vector difference value is not zero, that is, if at least one of the horizontal component and the vertical component is not zero, information related to AMVR can be additionally decoded (S5330).
[0693] Based on AMVR information, a variable amvrshift for scaling motion vector difference values can be derived. For example, as shown in the example in Table 4, a variable amvrshfit can be derived based on amvr_flag and / or amvr_prec_idx.
[0694] Afterwards, the decoded MVD can be scaled up using the variable amvrshift to obtain the motion vector difference value MVD restored to the original precision (S5340). Equation 18 shows an example of applying a scale-up operation to the decoded MVD.
[0695]
[0696] In Equation 18, MVD' represents the decoded motion vector difference value. MVD represents the motion vector difference value restored to its original precision, i.e., 1 / 16, through a scale-up operation.
[0697] Afterwards, the motion vector MV can be obtained by combining the motion vector difference value MVD restored to the original precision and the motion vector prediction value MVP.
[0698] As in the example above, when a 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 difference value MVD.
[0699] As described above, temporal motion information candidates can be derived from blocks temporally adjacent to the current block, i.e., collocated blocks. Here, the temporal motion information candidates can be used as motion information merging candidates or motion information prediction candidates depending on the inter-prediction mode.
[0700] Figure 54 is a diagram showing the location of the collocated block.
[0701] A collocated block may include a sample located inside or outside a collocated region (i.e., Col region) within a collocated picture (i.e., Col picture). Here, the collocated region may be a region having the same location and size as the current block within the collocated picture.
[0702] For example, a block containing sample C0 located outside the lower right corner of the collocated area may be set as a collocated block. Alternatively, a block containing sample C1 located in the center of the collocated area may be set as a collocated block.
[0703] A collocated block can be determined by searching for predefined sample locations according to a pre-set order. For example, sample C0 located outside the bottom-right corner of the collocated area and sample C1 located in the center of the collocated area can be searched sequentially, and the first available motion information found can be determined as the motion information of the collocated block. That is, if motion information exists at location C0, the motion information at location C0 can be set as the motion information of the collocated block, and if motion information does not exist at location C0, the motion information at location C1 can be set as the motion information of the collocated block.
[0704] If motion information does not exist at both the C0 and C1 locations, motion information candidates may not be derived from the collocated block.
[0705] Alternatively, if no motion information exists at both C0 and C1 locations, you can search for another location or set the default motion information to the motion information of the collocated block.
[0706] The motion information of a collocated block may include at least one of a reference picture index and a motion vector. If the reference picture pointed to by the reference picture index of the collocated block is not a target reference picture, the motion information of the collocated block may be modified to match the target reference picture. Specifically, the reference picture index of the collocated block may be changed to point to the target reference picture, and the motion vector of the collocated block may be scaled to match the target reference picture.
[0707] Figure 55 shows an example where the movement information of a collocated block is changed.
[0708] In FIG. 55, the target reference picture is exemplified as reference picture 0 with a POC of (N-1), and the reference picture of the collocated block is exemplified as reference picture 1 with a POC of (N-3). Additionally, the POC of the collocated picture is exemplified as (N+2). Here, N represents the POC of the current picture.
[0709] The reference picture index of the collocated block can be changed to point to the target reference picture, and the motion vector of the collocated block can be scaled. Scaling can be performed by multiplying the motion vector by a scaling parameter f.
[0710] The scaling parameter f can be derived based on the distance between the current picture and the target reference picture (i.e., the POC difference) and the distance between the collocated picture and the reference picture of the collocated block. Specifically, in the example illustrated in FIG. 55, the distance between the current picture and the target reference picture is 1 (i.e., N - (N-1)), and the distance between the collocated picture and the reference picture of the collocated block is 5 (i.e., (N+2) - (N-3)). The scaling parameter f can be derived as a ratio between the two distances. That is, the scaling parameter f can be set to 1 / 5.
[0711] A scaled motion vector can be derived by multiplying the motion vector of a collocated block by a scaling parameter f. That is, the scaled motion vector can be derived as (x0 / 5, y0 / 5) by multiplying the motion vector (x0, y0) of a collocated block by a scaling parameter f.
[0712] Modified motion information of a collocated block can be used to derive motion information candidates. For example, in the example illustrated in FIG. 55, the modified motion information of the collocated block may include a reference picture index pointing to reference picture 0 and a scaled motion vector (x0 / 5, y0 / 5). From the modified motion information, motion information merging candidates or motion vector prediction candidates can be derived.
[0713] Meanwhile, if the reference picture index of a collocated block points to a target reference picture, motion information candidates can be derived from the motion information of the collocated block without changing the motion information of the collocated block.
[0714] Information for identifying a collocated picture may be encoded and signaled. The information may include at least one of information indicating the orientation of the collocated picture or information indicating the index of the collocated picture. The information indicating the orientation of the collocated picture may indicate whether the collocated picture is included in the L0 reference picture list or the L1 reference picture list. The information indicating the index of the collocated picture may indicate the index of the reference picture corresponding to the collocated picture among the reference pictures included in the L0 reference picture list or the L1 reference picture list.
[0715] Alternatively, the reference picture with the shortest distance from the current picture (e.g., POC difference) can be set as the collocated picture. Specifically, among the reference pictures included in the L0 reference picture list and the reference pictures included in the L1 reference picture list, the reference picture with the smallest POC difference from the current picture can be set as the collocated picture.
[0716] In this case, if the distance between the current picture and the reference picture with the shortest distance to the current picture among the reference pictures included in the L0 reference picture list is the same as the distance between the current picture and the reference picture with the shortest distance to the current picture among the reference pictures included in the L1 reference picture list, then the reference picture in the L0 direction or the L1 direction can be set as the collocated reference picture according to a predefined priority. The predefined priority may be to prioritize the L0 direction or to prioritize the L1 direction.
[0717] According to a predefined priority, if the LX reference picture is selected but motion information of the collocated block within the selected LX reference picture is not available, a motion information candidate can be derived from the collocated block within the L(1-X) reference picture. Here, X can be 0 or 1. For example, if there is no available motion information at the C0 and C1 locations within the L0 reference picture, the L1 reference picture can be set as the collocated picture of the current block.
[0718] The target reference picture may be the reference picture with the smallest index within the reference picture list (i.e., the reference picture with index 0). Alternatively, the target reference picture may be the reference picture with the smallest POC with respect to the current picture within the reference picture list. Alternatively, information pointing to the target reference picture may be encoded and signaled. This information may be signaled through a parent header. Meanwhile, the target reference picture may be included in the reference picture list in the same direction as the collocated picture. For example, if the collocated picture is included in the L0 reference picture list, the target reference picture can be selected from the L0 reference picture list, and if the collocated picture is included in the L1 reference picture list, the target reference picture can be selected from the L1 reference picture list. Alternatively, the collocated picture can be set as the target reference picture.
[0719] In the example described above, the movement information of the collocated block is exemplified as being determined by sequentially searching for locations C0 and C1. However, the search locations are not limited to the illustrated example. The movement information of the collocated block may also be determined by searching for locations different from those illustrated or by searching for more candidate locations. As an example, a plurality of candidate locations may include at least one of the following: a location outside the bottom-right of the collocated area, a location outside the top-right of the collocated area, a location outside the top-left of the collocated area, a location outside the bottom-left of the collocated area, a central location within the collocated area, a location within the bottom-right of the collocated area, a location within the top-right of the collocated area, or a location within the bottom-left of the collocated area.
[0720] For convenience of explanation, in the embodiments described below, it is assumed that a plurality of location candidates consist of a lower-right outer location C0 of the collocated area and a central location C1 within the collocated area.
[0721] As another example, based on the motion information of multiple location candidates, the cost of each of the multiple location candidates is calculated, and a motion information candidate can be derived using the motion information of the location candidate with the smallest cost.
[0722] FIGS. 56 to 58 are drawings for explaining an example of calculating the cost of multiple location candidates.
[0723] For the sake of convenience of explanation, it is assumed that multiple location candidates include a first location candidate and a second location candidate. In this case, one of the first location candidate and the second location candidate may be location C0 outside the lower-right corner of the collocated area, and the other may be location C1 in the center of the collocated area.
[0724] Based on the motion information of the first position candidate, a reference template within the target reference picture can be specified. Specifically, the motion information of the first position candidate is modified to match the target reference picture, and based on the modified motion information, a reference template for the first position candidate within the target reference picture can be specified. That is, an area at a location offset from the same location as the current template within the target reference picture by the scaled motion vector of the first position candidate can be set as the reference template of the first position candidate. In FIG. 56, reference template 0 represents a reference template indicated by the scaled motion vector of the first position candidate.
[0725] Similarly, a reference template within the target reference picture can be specified based on the motion information of the second position candidate. That is, an area at a location spaced apart from the same location as the current template within the target reference picture by the scaled motion vector of the second position candidate can be set as the reference template of the second position candidate. In FIG. 56, reference template 1 represents a reference template indicated by the scaled motion vector of the second position candidate.
[0726] You can also specify a reference template without scaling the movement information of the location candidates.
[0727] For example, a reference template of a first candidate block can be specified within a reference picture indicated by the reference picture index of a first position candidate, and a reference template of a second candidate block can be specified within a reference picture indicated by the reference picture index of a second position candidate.
[0728] Specifically, if the motion information of the first position candidate and the motion information of the second position candidate both point to reference picture 1, as in the example shown in FIG. 57, the area of the location separated by the motion vector of the first position candidate from the same location as the current template in reference picture 1 can be set as the reference template of the first position candidate (i.e., reference template 0), and the area of the location separated by the motion vector of the second position candidate from the same location as the current template in reference picture 1 can be set as the reference template of the second position candidate (i.e., reference template 1).
[0729] Once a reference template for each location candidate is determined, the cost of each location candidate can be calculated based on the difference between the samples included in the reference template (i.e., reconstructed samples) and the samples included in the current template (i.e., reconstructed samples). The cost can be calculated based on SAD, SATD, MR-SAD, or SSD.
[0730] Alternatively, instead of the current template, a collocated template consisting of restoration regions adjacent to the collocated regions within the reference picture can be used. In this case, the cost of each location candidate can be calculated based on the difference between the samples included in the reference template and the samples included in the collocated template.
[0731] In Fig. 56, it is shown that the current template is used to calculate the cost of a location candidate, and in Fig. 57, it is shown that the collocated template is used to calculate the cost of a location candidate.
[0732] A collocated area can also be set as a collocated template. For example, as shown in the example illustrated in FIG. 58, an area with the same location and size as the current block within the collocated picture can be set as a template. The reference template of the location candidate can also have the same size as the collocated area.
[0733] A motion information candidate can be derived by utilizing the motion information of the position candidate with the smaller cost among the first and second position candidates. For example, if the cost of the first position candidate is lower than the cost of the second position candidate, a motion information candidate can be derived based on the motion information of the first position candidate (specifically, the modified motion information of the first position candidate). Conversely, if the cost of the second position candidate is lower than the cost of the first position candidate, a motion information candidate can be derived based on the motion information of the second position candidate (specifically, the modified motion information of the second position candidate).
[0734] After setting up multiple collocated pictures, motion information candidates may be derived from at least one of the multiple collocated pictures.
[0735] To this end, information for identifying each of the multiple collocated pictures can be encoded and signaled.
[0736] Alternatively, multiple collocated pictures can be determined according to rules predefined in the encoder and decoder. For example, the reference picture with the shortest distance to the current picture in the L0 reference picture list and the reference picture with the shortest distance to the current picture in the L1 reference picture list can each be set as collocated pictures.
[0737] Alternatively, each of the two reference pictures can be set as a collocated picture only if the distance between the current picture and the reference picture with the shortest distance to the current picture in the L0 reference picture list is the same as the distance between the current picture and the reference picture with the shortest distance to the current picture in the L1 reference picture list.
[0738] Alternatively, each of the N reference pictures in the L0 reference picture list and / or the M reference pictures in the L1 reference picture list can be set as a collocated picture. N and M can be 0 or greater than 0 integers. N and M may be the same or different.
[0739] For example, N reference pictures can be selected in ascending order of index within the L0 reference picture list, and M reference pictures can be selected in ascending order of index within the L1 reference picture list. Each of the selected (N+M) reference pictures can be set as a collocated picture.
[0740] If multiple collocated pictures exist, a candidate for the current block's motion information can be derived from one of the multiple collocated pictures. Specifically, the cost for a location candidate included in each of the multiple collocated pictures is calculated, and a candidate for the current block's motion information can be derived from the collocated picture containing the location candidate with the smallest cost.
[0741] At least one location candidate can be set within each collocated picture candidate. For example, at least one of the location C0 outside the bottom-right corner of the collocated area and the location C1 in the center of the collocated area can be used as a location candidate.
[0742] If there are two candidate locations, up to two costs can be calculated from each collocated picture. That is, if available motion information exists for both of the two candidate locations within the collocated picture, a cost can be calculated for each of the two candidate locations. For example, if there are two collocated pictures, up to four costs can be calculated from the two collocated pictures as follows.
[0743] (Cost of the first position candidate in the first collocated picture, cost of the second position candidate in the first collocated picture, cost of the first position candidate in the second collocated picture, cost of the second position candidate in the second collocated picture)
[0744] Alternatively, costs can be calculated only for the first location found that has available motion information as multiple location candidates are scanned sequentially. For example, a scan is performed in the order of a first location candidate (e.g., location C0) and a second candidate location (e.g., location C1), and costs can be calculated only for the first location candidate found that has available motion information.
[0745] Meanwhile, the cost of a location candidate can be calculated based on a reference template determined based on the changed movement information of the location candidate, as in the example shown in FIG. 56, or based on a reference template determined based on the original movement information of the location candidate, as in the example shown in FIG. 57.
[0746] Once the cost for each of the collocated pictures is calculated, a candidate for the current block's movement information can be derived from the collocated picture containing the location candidate with the lowest cost. In other words, a candidate for the current block's movement information can be derived based on the movement information of the location candidate with the lowest cost.
[0747] Alternatively, a list containing N location candidates can be constructed in order of decreasing cost. Subsequently, one of the location candidates included in the list is selected, and the movement information of the current block can be derived based on the movement information of the selected location candidate. To this end, information indicating one of the location candidates included in the list can be encoded and signaled.
[0748] Alternatively, N location candidates can be selected in order of decreasing cost. A motion information candidate for the current block can be derived from each of the N location candidates. That is, multiple motion information candidates can be derived from multiple collocated blocks. The derived multiple motion information candidates can be inserted into the motion information merging list or motion vector prediction list of the current block.
[0749] In the example described above, motion information candidates, namely temporal motion information candidates, are exemplified as being derived from a block containing samples of pre-set locations within a collocated picture.
[0750] As another example, motion information candidates, that is, temporal motion information candidates, can be derived from the block indicated by the initial motion information of the current block.
[0751] Initial movement information can be derived from a location spatially adjacent to the current block. Here, the location spatially adjacent to the current block may include at least one of the top location (B1 in FIG. 35), left location (A1 in FIG. 35), upper right location (B0 in FIG. 35), lower left location (A0 in FIG. 35), or upper left location (B5 in FIG. 35) of the current block.
[0752] A list can be constructed to induce initial movement information, and information indicating one of the candidates included in the list can be encoded and signaled.
[0753] Alternatively, motion information at a predefined location can be set as the initial motion information of the current block. For example, motion information existing at the left or top location of the current block can be set as the initial motion information of the current block. If there is no motion information at a predefined location, the zero vector (0, 0) can be set as the initial motion vector.
[0754] Alternatively, multiple location candidates can be scanned according to a pre-set order, and the first available movement information found can be set as the initial movement information of the current block. For example, when scanning is performed in the order of left location A1, top location B1, top-right location B0, bottom-left location A0, and top-left location B2, the first available movement information found can be set as the initial movement information of the current block.
[0755] Meanwhile, the searched motion information may be determined to be available only when the searched motion information points to a specific reference picture. Here, the specific reference picture may be a reference picture or a collocated picture with an index of 0 in the reference picture list.
[0756] Alternatively, multiple location candidates may be identified based on multiple initial movement information. Subsequently, after calculating the cost for each of the multiple location candidates, a motion information candidate—that is, a temporal motion information candidate—can be derived based on the motion information of the location candidate with the lowest cost.
[0757] For example, the cost of a first position candidate identified based on the movement information of the left position A1 and a second position candidate identified based on the movement information of the top position B1 can be calculated. Subsequently, a candidate for the movement information of the current block can be derived from the movement information of the position candidate with the smaller cost among the first and second position candidates.
[0758] Alternatively, a location indicated by initial movement information may be used as a single location candidate. That is, the plurality of location candidates may include a location candidate set based on the collocated area (e.g., at least one of a candidate including a location C0 outside the lower right corner of the collocated area or a candidate including a central location C1 of the collocated area) or at least one location candidate indicated by at least one initial movement information.
[0759] For each of the multiple location candidates, a cost is calculated, and based on the movement information of the location candidate with the smallest cost, movement information can be derived.
[0760] Meanwhile, as shown in the example illustrated in FIG. 56, the cost of a location candidate can be calculated based on a reference template determined based on the changed movement information of the location candidate. In this case, the changed movement information of the location candidate with the smallest cost can be set as the movement information candidate for the current block.
[0761] Alternatively, as in the example illustrated in FIG. 57, the cost of a location candidate can be calculated based on a reference template determined based on the original motion information of the location candidate. In this case, the motion information of the location candidate with the smallest cost is modified to match the target reference picture, and then a motion information candidate for the current block can be derived based on the modified motion information.
[0762] The motion information of the position candidate may also be corrected. Specifically, a corrected motion vector can be obtained by multiplying the motion vector of the position candidate by a scaling parameter f1 for correction. The scaling parameter f1 can be derived as the ratio of the distance between the collocated picture and the target reference picture (i.e., POC difference, hereinafter referred to as distance c) and the distance between the collocated picture and the reference picture pointed to by the motion information of the position candidate (hereinafter referred to as distance d). For example, in the example illustrated in FIG. 55, the distance between the collocated picture and the target reference picture is 3 ((N+2) - (N-1)), and the distance between the collocated picture and the reference picture pointed to by the motion information of the position candidate is 5 ((N+2) - (N-3)). Accordingly, the scaling parameter f1 can be set to 3 / 5 (i.e., c / d). Accordingly, the corrected motion vector RefinedMV, which corrects the motion vector TempMV (i.e., x0, y0) of the position candidate, can be TempMV * 3 / 5 (i.e., (x0 * 3 / 5, y0 * 3 / 5)).
[0763] Instead of using the original motion information of the location candidate, the reference template can be specified using corrected motion information.
[0764] The corrected motion information of the position candidate can be modified to match the target reference picture, and the motion information candidate of the current block can be derived from the modified motion information of the position candidate. For example, following the example of FIG. 55, the scaling parameter f can be derived as the ratio between the distance between the current picture and the target reference picture (hereinafter referred to as distance a) and the distance between the collocated picture and the reference picture pointed to by the motion information of the position candidate (hereinafter referred to as distance b). That is, in the example of FIG. 55, the scaling parameter f can be set to 1 / 3 (i.e., a / b). Accordingly, the scaled motion vector ScaledRefinedMV can be set to RefineMV * 1 / 3 (i.e., (x0 * 3 / 15, y0 * 3 / 15)).
[0765] Consequently, the modified motion information of the location candidate may include a reference picture index pointing to a target reference picture and a scaled motion vector ScaledRefinedMV. Based on the modified motion information of the location candidate, a motion information candidate for the current block can be derived.
[0766] Correction may also be performed on the induced motion information candidates. Specifically, based on the induced motion information candidates, a search range may be set according to the example illustrated in FIG. 36, and a reference template having the minimum cost within the search range may be searched. By correcting the motion vector of the motion information candidate to point to the reference template having the minimum cost, a corrected motion information candidate may be induced. The corrected motion information candidate may be inserted into the motion information candidate list of the current block.
[0767] It can be configured so that correction of a motion information candidate is performed only when the reference picture index of the induced motion information candidate points to the target reference picture. That is, if the reference picture index of the motion information candidate does not point to the target reference picture, the motion information candidate can be inserted into the motion information candidate list as is. On the other hand, if the reference picture index of the motion information candidate points to the target reference picture, the motion information candidate is corrected, and the corrected motion information candidate can be inserted into the motion information candidate list.
[0768] The predicted block of the current block can also be derived from the restored region within the current picture. Specifically, based on the block vector of the current block, a reference block within the current picture can be identified, and the reference block can be set as the predicted block of the current block. That is, the block vector can be set as the position difference between the reference block and the current block.
[0769] FIG. 59 is a diagram illustrating a search area where the prediction vector of the current block is derived.
[0770] In the example illustrated in FIG. 59, w0 and w1 are variables related to the width of the search area, and h0 and h1 are variables related to the height of the search range. Specifically, an upper restoration area of size ((w0+w1) x h0) and a left restoration area of size (w1 x (h0+h1)) can be set as the search range.
[0771] In the encoder, a reference block in the region most similar to the current block within the search region can be determined. Subsequently, the difference between the current block and the reference block is set as a block vector, and information regarding the block vector can be encoded and signaled so that the decoder can derive the block vector.
[0772] Meanwhile, a prediction method using block vectors can be referred to as an intra-block copy mode.
[0773] Intra-block copy mode can be applied to both the luminance and chroma components. Alternatively, it can be configured to apply Intra-block copy mode to only one of the luminance or chroma components.
[0774] Block vectors can be encoded based on a motion vector prediction mode or a motion information merging mode.
[0775] For example, similar to the case where a motion vector prediction mode is applied, a Block Vector Prediction List (BVP List) can be constructed, and the difference between a block vector predictor selected from the Block Vector Prediction List and a block vector can be encoded. Additionally, information indicating a selected block vector predictor within the Block Vector Prediction List can be encoded.
[0776] Alternatively, similar to when the motion information merging mode is applied, a block vector merging list can be constructed, and information indicating a block vector and a block vector merging candidate identical to the block vector of the current block can be encoded.
[0777] Alternatively, the block vector of the current block can be derived through template matching. That is, after searching for the reference template most similar to the template of the current block within the current picture, the positional difference between the current template and the reference template can be set as the block vector of the current block.
[0778] The current block can be divided / decomposed into multiple regions, and predictions can be performed individually for each of the multiple regions.
[0779] Figure 60 shows an example where the current block is separated into multiple regions.
[0780] After dividing the current area into multiple sub-blocks, the area to which the sub-block belongs can be determined based on the location of each sub-block. In FIG. 60, the area to which the sub-block belongs is exemplified as being determined based on the row index and column index to which the sub-block belongs. Specifically, sub-blocks with an odd column index and an even row index, and sub-blocks with an even column index and an odd row index belong to the first area, and sub-blocks with both an even column index and a row index, and sub-blocks with both an odd column index and a row index belong to the second area.
[0781] A subblock may be configured to include at least one sample. For example, the size of a subblock may be NxM. N and M may be adaptively determined based on the size and / or shape of the current block. Alternatively, the size of the subblock may be predefined in the encoder and decoder. N and M may have the same value or different value.
[0782] Multiple regions can be encoded / decoded sequentially. That is, in the example illustrated in FIG. 60, the region to be encoded / decoded first among the first region and the second region can be determined.
[0783] In the encoder, information indicating the encoding / decoding order of multiple regions can be encoded and signaled.
[0784] Alternatively, the encoding / decoding order of multiple regions may be determined according to a predefined order in the encoder and decoder. For example, the predefined order may be the order of the first region and the second region, or the order of the second region and the first region.
[0785] In the following, it is assumed that encoding / decoding proceeds in the order of the first region and the second region. Also, it is assumed that the size of the sub-block is 2x2.
[0786] For encoding of the first region, prediction for the first region can be performed. Prediction for the first region can be performed by intra-prediction, inter-prediction, or intra-block copying.
[0787] Figure 61 shows an example in which a prediction is performed for the first region.
[0788] In FIG. 61, it is exemplified that a prediction is performed for the first region based on the 22nd intra prediction mode.
[0789] Intra prediction for the first region that is first encoded / decoded can be performed using reference samples existing outside the current block. In FIG. 61, intra prediction for the first region is exemplified as being performed using reference samples belonging to a reference sample line adjacent to the current block.
[0790] After performing a prediction for the first region, residual samples can be derived for each sub-block belonging to the first region. At this time, each sub-block can be encoded / decoded independently. That is, transformation and quantization of the residual samples can be performed independently for each sub-block. That is, transformation and quantization are performed on the residual samples of a 2x2 size sub-block to generate up to 4 residual coefficients, and inverse quantization and inverse transformation are performed on the generated residual coefficients to recover the residual samples of the sub-block.
[0791] As another example, multiple sub-blocks belonging to the first region can be combined for encoding / decoding.
[0792] FIG. 62 shows an example in which encoding / decoding is performed in block units that integrate multiple sub-blocks.
[0793] In FIG. 62, sub-blocks placed on the same horizontal line are grouped together to form a transformation unit (i.e., a transformation block). Here, the transformation unit may represent a unit in which transformation / inverse transformation and quantization / inverse quantization are performed. That is, sub-blocks with the same row index can be set as a single transformation unit. Accordingly, in FIG. 62, the transformation unit is exemplified as having a size of 4x2.
[0794] Unlike the example shown in FIG. 62, a conversion unit can be established by grouping sub-blocks placed on the same vertical line together. In this case, the conversion unit can have a size of 2x4.
[0795] Alternatively, four sub-blocks may be integrated to form a single conversion unit. For example, in the example illustrated in FIG. 62, four 2x2 sub-blocks located at the top may be integrated to form a 4x4 conversion unit, and four 2x2 sub-blocks located at the bottom may be integrated to form a 4x4 conversion unit.
[0796] Alternatively, the sum of all sub-blocks belonging to the first region may be set as the transformation unit. That is, if the current block is separated into two regions, the transformation unit may have half the size of the current block.
[0797] Residual coefficients can be generated by performing transformation and quantization on the transformation unit, and residual samples can be recovered by performing inverse quantization and inverse transformation on the generated residual coefficients.
[0798] After restoring residual samples for each sub-block, the restored residual samples and predicted samples can be combined to derive the restored samples of the sub-block.
[0799] After restoring the first region, a prediction for the second region can be performed for encoding the second region. The prediction for the second region can be performed based on at least one of inter-prediction, intra-prediction, or intra-block copying.
[0800] The prediction method for each of the first and second regions can be determined independently.
[0801] Alternatively, the same prediction method applied to the first area may be forced to be applied to the second area.
[0802] Alternatively, a different prediction method may be forced to be applied to the second region. That is, a prediction method applied to the first region may not be applied to the second region. For example, inter-prediction may be applied to the first region, while intra-prediction may be applied to the second region.
[0803] Alternatively, only intra-prediction can be set as the prediction method for the second domain.
[0804] When intra prediction is performed in the second region, the reconstructed samples of the first region may be used as reference samples for the prediction in the second region. That is, when intra prediction is performed in both the first and second regions, the intra prediction for the first region is performed using reconstructed samples located outside the current block as reference samples, whereas the prediction for the second region may be performed using not only reconstructed samples located outside the current block but also reconstructed samples of the first region within the current block as reference samples.
[0805] In FIG. 60, when intra prediction is performed for a sub-block at position A belonging to the second region, the top, left, bottom, and right sub-blocks of the sub-block at position A are all restored. That is, not only the top and left restored samples, but also the right and bottom restored samples can be used as reference samples.
[0806] In consideration of this, when performing intra prediction for a sub-block belonging to the second region, not only general directional intra prediction modes but also intra prediction modes in the opposite direction of the general directional intra prediction modes may be configured to be available.
[0807] FIG. 63 illustrates general directional intra prediction modes and opposite directional intra prediction modes.
[0808] FIG. 63 (a) illustrates general directional intra prediction modes, and FIG. 63 (b) illustrates intra prediction modes with directions opposite to the general directional intra prediction modes.
[0809] That is, not only a general directional intra prediction mode, but also an intra prediction mode opposite to the general directional intra prediction mode can be used to perform intra prediction for sub-blocks belonging to the second region.
[0810] A general directional intra prediction mode can be referred to as a forward intra prediction mode, and an intra prediction mode opposite to the general directional intra prediction mode can be referred to as a reverse intra prediction mode.
[0811] Figure 64 shows an example in which intra prediction is performed based on a reverse intra prediction mode.
[0812] When the reverse intra prediction mode is selected, intra prediction can be performed using reference samples located on the right and bottom of the sub-block. As described through FIG. 14, intra prediction can be performed by configuring the right reference samples and the bottom reference samples into a 1D array. At this time, depending on the selected reverse intra prediction mode, the right reference samples can be projected to the bottom to use a 1D array composed of bottom reference samples, or the bottom reference samples can be projected to the right to use a 1D array composed of right reference samples.
[0813] For example, if the selected inverse intra prediction mode is facing downward, intra prediction can be performed using a 1D array composed of bottom reference samples. On the other hand, if the selected inverse intra prediction mode is facing right, intra prediction can be performed using a 1D array composed of right reference samples.
[0814] A prediction sample of a sub-block may also be derived by weighting the first prediction sample obtained based on the forward intra-prediction mode and the second prediction sample obtained based on the reverse intra-prediction mode.
[0815] Meanwhile, if a sub-block is adjacent to the right boundary of the current block, there may not be any previously restored samples to the right of the sub-block, and if a sub-block is adjacent to the bottom boundary of the current block, there may not be any previously restored samples to the bottom of the sub-block. Accordingly, if a sub-block is adjacent to the right or bottom boundary of the current block, the reverse intra prediction mode may be set to be unavailable.
[0816] Alternatively, by deriving sample values at locations where no previously restored samples exist through padding, the inverse intra prediction mode can be enabled for sub-blocks adjacent to the right or bottom boundary of the current block.
[0817] Even when the non-directional intra prediction mode is selected, right and bottom reference samples, as well as left and top reference samples, can be used.
[0818] FIG. 65 illustrates an example in which intra prediction is performed for a sub-block belonging to a second region based on a non-directional intra prediction mode.
[0819] Under planner mode, a prediction sample can be obtained by averaging or weighting a horizontal prediction sample P1 generated through horizontal interpolation and a vertical prediction sample P2 generated through vertical interpolation. At this time, the horizontal prediction sample P1 for a sub-block belonging to the second region is generated by interpolating a left reference sample and a right reference sample, and the vertical prediction sample P2 is generated by interpolating an upper reference sample and a lower reference sample.
[0820] For example, in the example illustrated in FIG. 65, the predicted sample at position p can be obtained using a horizontal predicted sample P1 obtained by interpolating a left reference sample l and a right reference sample r that are on the same horizontal line as the predicted sample, and a vertical predicted sample P2 obtained by interpolating an upper reference sample u and a lower reference sample d that are on the same vertical line as the predicted sample.
[0821] Meanwhile, when generating a horizontal prediction sample P1, the weights assigned to the left reference sample l and the right reference sample r can be determined based on the distance between the prediction sample p and the left reference sample l and the distance between the prediction sample p and the right reference sample r. Similarly, when generating a vertical prediction sample P2, the weights assigned to the upper reference sample u and the lower reference sample d can be determined based on the distance between the prediction sample p and the upper reference sample u and the distance between the prediction sample p and the lower reference sample d.
[0822] When DC mode is selected, an average value (i.e., DCval) can be derived based on at least one of the left reference samples, right reference samples, top reference samples, or bottom reference samples of the sub-block, and the derived average value can be set as the value of the predicted sample.
[0823] For example, if the current sub-block belongs to the second region, the average value of the reference samples belonging to the first region among the left reference samples, right reference samples, top reference samples, and bottom reference samples adjacent to the current sub-block can be set as the prediction sample of the sub-block belonging to the second region.
[0824] Alternatively, the average value of all left reference samples, right reference samples, top reference samples, and bottom reference samples adjacent to the current sub-block can be set as the prediction sample of the sub-block belonging to the second region.
[0825] Alternatively, the average value of samples included in one or more sub-blocks belonging to a first region adjacent to the current sub-block may be set as the predicted sample of a sub-block belonging to a second region. Here, the sub-block belonging to the first region adjacent to the current sub-block may include at least one of a sub-block adjacent to the top of the current sub-block, a sub-block adjacent to the left, a sub-block adjacent to the right, and a sub-block adjacent to the bottom.
[0826] Alternatively, the average value of all restored samples belonging to the first region can be set as the prediction sample of the sub-block belonging to the second region. That is, in the example illustrated in FIG. 60, the average value of all samples existing in the first region within the current block can be set as the prediction sample of the sub-block belonging to the second region.
[0827] Depending on the form of the sub-block, the reference samples used to derive the average value may differ.
[0828] Figure 66 shows an example in which reference samples used to derive the average value are set differently depending on the sub-block or current block shape.
[0829] As in the example illustrated in FIG. 66 (a), when the sub-block or current block is a non-square shape where the width is greater than the height, the average value can be calculated using only the top reference samples and the bottom reference samples.
[0830] On the other hand, as in the example shown in Fig. 66 (b), if the sub-block or current block is non-square in shape with a height greater than the numbo, the average value can be calculated using only the left reference samples and the bottom reference samples.
[0831] In other words, only reference samples adjacent to the longer of the horizontal and vertical sides can be used to derive the average value.
[0832] Meanwhile, if the current block is separated into multiple regions, intra prediction can be configured to use only adjacent reference sample lines in a fixed manner.
[0833] Alternatively, for the first region among the multiple regions to be encoded / decoded, it is possible to allow the selection of one of the multiple reference sample lines, whereas for the next region to be encoded / decoded, it is possible to set it to use only the adjacent reference sample line in a fixed manner.
[0834] If the current block is a chroma component block, at least one of the first region or the second region can be predicted using the reconstructed luminance block. In this case, the prediction parameters for the sub-block belonging to the second region can be derived based on the reconstructed samples around the chroma sub-block and the reconstructed samples around the luminance block.
[0835] In deriving prediction parameters for a sub-block within a second region, the luminance reference region may be configured to include at least one of the left, top, right, and bottom restoration regions of the luminance sub-block corresponding to the sub-block, and the chroma reference region may be configured to include at least one of the left, top, right, and bottom restoration regions of the chroma block.
[0836] Figure 67 is a diagram illustrating luminance reference samples and chroma reference samples used to derive prediction parameters.
[0837] As shown in the example illustrated in Fig. 67, not only the reconstructed samples included in the left and upper reconstructed regions of the Luma block and Chroma block, respectively, but also the reconstructed samples included in the right and lower reconstructed regions can be derived to use the prediction parameters.
[0838] Meanwhile, prediction parameters can be derived at the sub-block level.
[0839] The current block can be separated / decomposed into multiple regions in a manner different from that shown in Fig. 60.
[0840] Figures 68 and 69 show examples of how the current block is separated by line.
[0841] In the example illustrated in FIG. 68, columns with odd indices are separated into a first region, and columns with even indices are separated into a second region. That is, in the example illustrated in FIG. 68, the sub-block can have a size of 1x4.
[0842] In the example illustrated in FIG. 69, rows with odd indices are separated into a first region, and rows with even indices are separated into a second region. That is, in the example illustrated in FIG. 69, the sub-block can have a size of 4x1.
[0843] As shown in the examples illustrated in FIGS. 68 and 69, multiple lines may be set as a single sub-block. For example, the sub-block may have a size of 2x4 or 4x2.
[0844] Afterwards, sub-blocks with even indices among the sub-blocks can be set as the first area, and sub-blocks with odd indices among the sub-blocks can be set as the second area.
[0845] If the first region is encoded / decoded before the second region, the restored samples within the first region can be used as reference samples when predicting the second region.
[0846] On the other hand, if the second region is encoded / decoded before the first region, the restored samples within the second region can be used as reference samples when predicting the first region.
[0847] Figure 70 shows an example in which samples included in the first region are predicted using restoration samples included in the second region.
[0848] For each line (i.e., sub-block) belonging to the first region, the reference samples for intra-prediction may differ.
[0849] For example, when using a left-direction intra prediction mode, intra prediction for the first column of the current block can be performed by setting the reconstructed samples located outside the current block as left reference samples.
[0850] On the other hand, intra prediction for the third column of the current block can be performed by setting the reconstructed samples contained in the adjacent column (i.e., the second column) as left reference samples.
[0851] When the non-directional intra prediction mode is selected, prediction using adjacent reference samples can be performed.
[0852] Figure 71 shows an example of predicting samples included in the first region based on a non-directional intra prediction mode.
[0853] When a DC mode is generated, the predicted values of samples belonging to the prediction target line (i.e., prediction target sub-block) within the first region can be set to the average value of adjacent reference samples.
[0854] At this time, the average value can be derived by averaging the reconstructed samples belonging to two lines adjacent to the line to be predicted. For example, in the example illustrated in FIG. 71, the average value for the first column within the current block can be derived by averaging the reconstructed samples existing to the left of the current block and the reconstructed samples belonging to the second column.
[0855] Alternatively, one of the two lines belonging to the prediction target line can be selected, and the average value can be derived by averaging the reconstructed samples belonging to the selected line. For example, for the first column within the current block, the average value of the reconstructed samples to the left of the current block can be used, and for the third column within the current block, the average value of the reconstructed samples in the second column can be used.
[0856] Meanwhile, reference samples that are in contact with the shorter of the horizontal and vertical sides of a sub-block may not be used. For example, as in the example illustrated in FIG. 71, when intra-prediction is performed on a column basis, reference samples located at the top and / or bottom of the column where intra-prediction is performed may not be used when calculating the average value.
[0857] Alternatively, as in the example illustrated in FIG. 69, when intra-prediction is performed on a row-by-row basis, reference samples located to the left and / or right of the row where intra-prediction is performed may not be used when calculating the average value.
[0858] Meanwhile, when calculating the average value, reference samples located on the side with the smaller area in contact with the line may not be used. For example, as in the example shown in FIG. 68, when the block is divided in the vertical direction, the upper reference sample may not be considered when calculating the average value. Or, as in the example shown in FIG. 69, when the block is divided in the horizontal direction, the left reference sample may not be considered when calculating the average value.
[0859] Depending on the separation / decomposition form (or type) of the current block, the available prediction mode may be set differently.
[0860] For example, as in the example illustrated in FIG. 68, when the current block is divided into vertically long sub-blocks, only the left-facing intra-prediction modes (e.g., intra-prediction modes 2 through 33) and / or the right-facing intra-prediction modes (e.g., intra-prediction modes opposite to intra-prediction modes 2 through 33) among the directional intra-prediction modes may be available for intra-prediction of the sub-blocks.
[0861] On the other hand, as in the example illustrated in FIG. 69, when the current block is divided into horizontally long sub-blocks, only the directional intra-prediction modes facing upward (e.g., intra-prediction modes 34–66) and / or the directional intra-prediction modes facing downward (e.g., intra-prediction modes opposite to intra-prediction modes 34–66) may be available for intra-prediction of the sub-blocks.
[0862] Limiting the available intra-prediction modes can be applied to all of the multiple domains.
[0863] Alternatively, the above restriction does not apply to the first region among the multiple regions that is encoded / decoded, and may apply only to the remaining regions.
[0864] In the example described above, sub-blocks at spatially non-contiguous locations were illustrated as constituting a single region. Regions can also be divided at the sample level rather than at the sub-block level. That is, samples at spatially non-contiguous locations can be organized into a single region.
[0865] Figure 72 shows an example where multiple samples at discontinuous locations are defined as a single region.
[0866] In the example illustrated in FIG. 72, the first to fourth regions can be defined as follows.
[0867] Region 1: Samples where both x-axis and y-axis coordinates are even
[0868] Region 2: Samples with odd x-axis coordinates and even y-axis coordinates
[0869] Region 3: Samples with even x-axis coordinates and odd y-axis coordinates
[0870] Region 4: Samples where both x-axis and y-axis coordinates are odd
[0871] In the example described above, sub-blocks at non-consecutive locations or samples at non-consecutive locations were exemplified as constituting a single region. Unlike the example, it may also be configured so that sub-blocks at consecutive locations or samples at consecutive locations constitute a single region.
[0872] To reduce the amount of bits encoded / decoded, encoding / decoding may be performed on only at least one of the multiple regions, and encoding / decoding may be skipped for the remaining regions. In this case, the reconstructed samples of the regions where encoding / decoding was skipped may be generated through interpolation of the reconstructed samples of the regions where encoding / decoding was performed.
[0873] FIG. 73 illustrates an example in which restoration samples of residual regions are derived based on restoration samples of regions where explicit encoding / decoding is performed.
[0874] For example, in the example illustrated in FIG. 73, explicit encoding / decoding is performed on the first of the four regions that is encoded / decoded, whereas encoding / decoding can be skipped for the remaining regions.
[0875] Meanwhile, information indicating the encoding / decoding order of the four regions can be encoded and signaled.
[0876] Alternatively, the encoding / decoding order of the four regions may be predefined in the encoder and decoder. For example, encoding / decoding may be performed in the order of the first region, the second region, the third region, and the fourth region, or in the order of the fourth region, the third region, the second region, and the first region.
[0877] For convenience of explanation, in the following embodiments, it is assumed that encoding / decoding is performed in the order of the fourth region, the third region, the second region, and the first region.
[0878] The fourth region that is first encoded / decoded can be encoded / decoded based on at least one of intra-prediction, inter-prediction, or intra-block copying.
[0879] For the fourth region, explicit encoding / decoding using prediction, transformation, and quantization is performed, whereas for the first to third regions, encoding / decoding may be omitted. In this case, the reconstructed samples of the first to third regions may be generated based on the reconstructed samples in the fourth region.
[0880] Specifically, restoration samples within the third region can be generated using restoration samples belonging to the fourth region and restoration samples existing to the left of the current block. Specifically, restoration samples within the third region can be generated through horizontal interpolation of the restoration sample existing to the right and the restoration sample existing to the left of the sample within the third region.
[0881] Restoration samples within the second region can be generated using restoration samples belonging to the fourth region and restoration samples existing at the top of the current block. Specifically, restoration samples within the second region can be generated through vertical interpolation of the restoration sample existing at the top and the restoration sample existing at the bottom of the sample within the second region.
[0882] Restoration samples within the first region can be generated using at least one of restoration samples outside the current block, restoration samples in the third region, and restoration samples in the second region.
[0883] Alternatively, for the remaining regions excluding the first region to be encoded / decoded, encoding / decoding may be explicitly performed, and the predicted samples of the remaining regions may be obtained through the interpolation of the previously restored samples.
[0884] For example, a value generated through horizontal interpolation between a restored sample to the right of a sample within the third region and a restored sample to the left can be set as a predicted sample. In this case, residual samples are derived by differencing the predicted sample from the original sample within the third region, and residual coefficients generated through transformation and quantization can be explicitly encoded.
[0885] Accordingly, for the fourth region that is encoded / decoded first, both prediction information and residual information are encoded and signaled, whereas for the remaining regions excluding the fourth region, the encoding / decoding of prediction information is omitted, and only residual information can be encoded / decoded.
[0886] In the embodiments described above, a plurality of regions are exemplified as being encoded / decoded in a predetermined order. Accordingly, the reconstructed samples of the previously encoded / decoded regions are exemplified as being available as reference samples for predicting other regions.
[0887] As another example, only the prediction order among multiple regions can be determined. That is, the prediction of the next region can be performed while the encoding / decoding within the previously predicted region is not yet complete. In this case, the prediction samples from the previously predicted region can be used as reference samples for the prediction of the other region.
[0888] If the current block is separated / divided into multiple regions, the multiple regions can be predicted by the same intra prediction mode. In this case, information indicating the intra prediction mode of the multiple regions can be encoded and signaled only once.
[0889] Alternatively, the intra-prediction mode between multiple regions can be determined independently. In this case, information regarding the intra-prediction mode can be encoded and signaled for each region.
[0890] When intra-prediction is applied, the intra-prediction mode for each region can be derived based on the histogram.
[0891] Alternatively, when intra prediction is applied, the intra prediction for each region can be derived based on a method of selecting at least one intra prediction mode in order of lowest cost by performing multiple intra predictions in a reference region.
[0892] Alternatively, information regarding the intra-prediction mode may be encoded / decoded only for the first region that is encoded / decoded, and for the remaining regions, a method of deriving the intra-prediction mode based on a histogram or a method of selecting at least one intra-prediction mode based on the cost of the intra-prediction modes may be applied.
[0893] Alternatively, for the first region among the first region and the second region, encoding / decoding may be performed based on at least one of a plurality of intra prediction modes, while for the second region, a default intra prediction mode may be applied. The default intra prediction mode may be a planner mode or a DC mode. In this case, information indicating the intra prediction mode may be encoded / decoded only for the first region.
[0894] Alternatively, both the intra prediction mode applied to the first region and the default intra prediction mode may be applied to the second region. That is, prediction samples within the second region may be obtained through the average or weighted sum operation of a first prediction sample obtained based on the intra prediction mode applied to the first region and a second prediction sample obtained based on the default intra prediction mode.
[0895] Information for determining the separation / decomposition form (or type) of the current block may be encoded and signaled. The information may include at least one of a flag indicating whether the current block is separated / decomposed into multiple regions or information indicating the separation / decomposition type of the current block.
[0896] The separation / decomposition type may indicate at least one of the number of regions within the current block, or the size / location of sub-blocks or samples constituting each region.
[0897] Information indicating the separation / decomposition type may be an index indicating one of multiple separation / decomposition type candidates.
[0898] Information for determining the separation / decomposition type of the current block can be encoded and signaled on a block-by-block basis.
[0899] Alternatively, the above information may be encoded and signaled through a top header. The top header may include at least one of a slice, a sub-picture, a picture, or a sequence. For example, when the above information is signaled through a slice header, the separation / decomposition type of all blocks referencing the slice header may be the same.
[0900] The separation / decomposition types for the lumina and chroma components can be the same.
[0901] Alternatively, the separation / decomposition type for the lumina component and the chroma component can be determined independently.
[0902] Alternatively, depending on the tree type, it may be determined whether the separation / decomposition types for the luminal and chromal components are determined independently. For example, if the partitioning structure of the chromal block is identical to the partitioning structure of the luminal block (i.e., the tree type is a single tree), the separation / decomposition type of the luminal block may be applied equally to the chromal block. On the other hand, if the partitioning structure of the chromal block is independent of the partitioning structure of the luminal block (i.e., the tree type is a dual tree), the separation / decomposition type of the luminal block may be determined independently of the separation / decomposition type of the chromal block.
[0903] FIG. 74 is a flowchart of a method for performing encoding / decoding by separating / decomposing the current block into multiple regions.
[0904] The separation / decomposition type of the current block can be determined (S7410). Depending on the separation / decomposition type, the number of regions constituting the current block, and the number of sub-blocks or samples included in each region can be determined.
[0905] Encoding / decoding can be performed on the first region among multiple regions (S7420). If the prediction method of the first region is intra prediction, the first intra prediction can be performed by using the restored samples outside the current block as reference samples.
[0906] Next, encoding / decoding can be performed on the second region among the multiple regions (S7430). If the prediction method of the second region is intra prediction, not only the reconstructed samples outside the current block but also the reconstructed samples included in the first region can be used as reference samples for intra prediction of the second region.
[0907] Alternatively, the restoration samples outside the current block and the restoration samples included in the first region may be interpolated and set as the restoration samples or prediction samples of the second region.
[0908] If more than two regions are included, encoding / decoding can be performed sequentially according to the pre-set encoding / decoding order.
[0909] After performing a prediction on the current block, the residual block can be obtained by differencing the original block and the predicted block.
[0910] FIG. 75 is a flowchart of a method for encoding a residual block in an encoder, and FIG. 76 is a flowchart of a method for recovering a residual block in a decoder.
[0911] In the encoder, residual coefficients can be obtained by performing at least one of transform or quantization on the residual block (S7510, S7520). If quantization is omitted for the residual block, the residual coefficients may refer to transform coefficients obtained by transforming. Alternatively, if both transform and quantization are performed on the residual block, the residual coefficients may refer to quantized transform coefficients obtained by quantizing the transform coefficients. Alternatively, if the transformation is omitted for the residual block, the residual coefficients may be obtained by quantizing the residual samples.
[0912] In addition, the encoder can encode the residual coefficient (specifically, entropy encoding) and transmit the encoded data to the decoder (S7530).
[0913] The decoder decodes the encoded data to recover the residual coefficients (S7610). Then, it performs inverse quantization on the residual coefficients to derive transform coefficients (i.e., inverse quantized residual coefficients), and performs inverse transform on the transform coefficients to derive the residual block (S7620, S7630).
[0914] Information indicating whether a transformation is applied to the current block may be encoded and signaled. For example, transform_skip_flag may be encoded and signaled. If transform_skip_flag is 1, it indicates that no transformation is applied to the current block. Here, the transformation may include not only the first transformation described later, but also the second transformation. If transform_skip_flag is 0, it indicates that a transformation is applied to the current block. If transform_skip_flag is 0, the first transformation is necessarily applied to the current block, while the second transformation may be optionally applied.
[0915] The transformation for the current block may be performed based on at least one of a plurality of transformation kernel candidates. For example, a transformation kernel applicable to the current block may be a transformation kernel of the DCT (Discrete Cosine Transform) family or a transformation kernel of the DST (Discrete Sine Transform) family.
[0916] Equations 19 through 21 represent basis functions of transformation kernels applicable to the current block. Equation 19 represents the basis function for DCT-2, Equation 20 represents the basis function for DCT-8, and Equation 21 represents the basis function for DST-7.
[0917]
[0918]
[0919]
[0920] If multiple transformation kernel candidates exist, information indicating the transformation kernel applied to the current block among the multiple transformation kernel candidates can be encoded and signaled. Here, the transformation kernel candidate may include at least one of DCT-2, DST-7, or DCT-8. Additionally, the information may be an index indicating one of the multiple transformation kernel candidates.
[0921] Meanwhile, the transformations for the horizontal direction and the vertical direction of the current block can be separated. In this case, a common transformation kernel can be applied to both the horizontal and vertical directions. That is, if one of multiple transformation kernel candidates is selected, the selected transformation kernel can be applied to both the horizontal and vertical transformations of the current block.
[0922] Alternatively, the transformation kernels for the horizontal and vertical directions can be determined independently. In this case, the encoder can encode and signal information indicating the transformation kernel for the horizontal direction and information indicating the transformation kernel for the vertical direction, respectively.
[0923] Alternatively, multiple transformation kernel combination candidates indicating a combination of a horizontal transformation kernel and a vertical transformation kernel may be defined, and information indicating one of the multiple transformation kernel combination candidates may be encoded and signaled. Table 5 is an example of multiple transformation kernel combination candidates.
[0924] Index 01 234 Horizontal Direction Conversion DCT-2 DST-7 DCT-8 DST-7 DCT-8 Vertical Direction Conversion DCT-2 DST-7 DST-7 DCT-8 DCT-8
[0925] In the decoder, a transformation kernel for the horizontal direction and a transformation kernel for the vertical direction can be determined based on an index indicating one of a plurality of candidate transformation kernel combinations.
[0926] Meanwhile, information indicating whether the conversion kernel for horizontal and vertical conversions is determined integrally may be encoded / decoded. The information may be a 1-bit flag.
[0927] For example, if the above information indicates that the transformation kernels for horizontal and vertical transformations are determined integrally, an index indicating one of multiple transformation kernel candidates may be encoded / decoded. The transformation kernel indicated by the index may be applied to both the horizontal and vertical transformations of the current block.
[0928] On the other hand, if the above information indicates that the transformation kernels for horizontal and vertical transformations are not determined integrally, an index indicating one of multiple candidate transformation kernel combinations may be encoded / decoded. The combination of the horizontal transformation kernel and the vertical transformation kernel indicated by the index may be applied to the current block.
[0929] After performing the aforementioned transformation, additional transformations may be performed on the current block. For the sake of convenience of explanation, the transformation performed by a DCT or DST-based transformation kernel will be referred to as the first transformation, and the transformation additionally applied to the result of the first transformation will be referred to as the second transformation. Furthermore, the transformation coefficients generated as a result of the first transformation will be referred to as the first transformation coefficients, and the transformation coefficients generated as a result of the second transformation will be referred to as the second transformation coefficients.
[0930] In the encoder, a second transformation can be performed on the first transformation coefficients generated as a result of performing the first transformation to generate second transformation coefficients.
[0931] When both the first and second transforms are performed in the encoder, the decoder can generate the first transform coefficients by performing a second inverse transform (i.e., the inverse transform of the second transform) on the inversely quantized residual coefficients (i.e., the second transform coefficients). Then, residual samples can be obtained by performing a first inverse transform (i.e., the inverse transform of the first transform) on the first transform coefficients.
[0932] The second transformation may be applied to at least some of the first transformation coefficients. For example, depending on the size of the second transformation kernel, the second transformation may be applied to 16, 48, or 64 first transformation coefficients. The shape of the region containing the first transformation coefficients to which the second transformation is applied may be square, non-square, or polygonal.
[0933] Mathematical Equation 22 represents the application pattern of the second transformation.
[0934]
[0935] When the second transformation is performed, the first transformation coefficients can be aligned in one dimension. For example, in the above Equation 22, A Nx1 represents the first transformation coefficients consisting of N rows and 1 column. Also, B Rx1 represents the second transformation coefficients consisting of R rows and 1 column. T RXN represents a second transformation kernel consisting of R rows and N columns.
[0936] Figures 77 and 78 are drawings showing an example to which the second transformation is applied.
[0937] FIG. 77 illustrates an example where the second transformation kernel is 64x64 in size. The first transformation coefficients generated as a result of the first transformation within an 8x8 block can be arranged in one dimension. At this time, the first transformation coefficients can be scanned using a predetermined scanning method to generate a one-dimensional array. The predetermined scanning method may include at least one of a diagonal scan, a horizontal scan, a vertical scan, or a raster scan.
[0938] When a 64x1 input matrix is generated through the above rearrangement, the second transformation coefficient can be derived through matrix multiplication between the 64x64 second transformation kernel and the 64x1 input matrix.
[0939] As a result of performing the second transformation, 64 second transformation coefficients are generated, and the second transformation coefficients within an 8x8 block can be rearranged. After quantizing the 8x8 block in which the second transformation coefficients have been rearranged, the quantized transformation block can be encoded.
[0940] FIG. 78 shows an example where the second transformation kernel is 48x48 in size. Among the first transformation coefficients generated as a result of the first transformation within the 8x8 block, 48 first transformation coefficients can be rearranged in one dimension. At this time, the 48 first transformation coefficients may be included in a polygonal shape area excluding the 4x4 sub-block at the bottom right of the 8x8 block.
[0941] When 48 first transformation coefficients are rearranged into one dimension to generate a 48x1 input matrix, the second transformation coefficients can be derived through matrix multiplication between a 48x48 second transformation kernel and a 48x1 input matrix.
[0942] As a result of performing the second transformation, 48 second transformation coefficients are generated, and the second transformation coefficients within the 8x8 block can be rearranged. For example, the 48 second transformation coefficients can be rearranged in a polygonal area excluding the bottom-right 4x4 sub-block within the 8x8 block.
[0943] In regions where the second transformation coefficients are not placed, the first transformation coefficients may be retained as they are. After applying quantization to a block containing the second transformation coefficients and the first transformation coefficients, the quantized transformation block can be encoded.
[0944] Alternatively, the transformation coefficients in the region where the second transformation coefficients are not placed may be set to 0. That is, the values of the transformation coefficients in the region where the second transformation is not applied may be set to 0, and then quantization and encoding may proceed.
[0945] The size of the second transformation kernel can be determined based on the size of the current block. For example, if at least one of the width or height of the current block is 4, the second transformation can be applied to 16 first transformation coefficients. On the other hand, if the width and height of the current block are 8 or greater, the second transformation can be applied to 48 or 64 first transformation coefficients.
[0946] Alternatively, information indicating the size and type of the second transformation kernel may be encoded and signaled. The information may be signaled at the block level. For example, information specifying at least one of the number of rows or the number of columns of the transformation size may be encoded. Alternatively, different indices may be assigned to each of the combinations of the number of rows and columns, and then an index specifying one of the combinations may be encoded. Alternatively, different indices may be assigned to each of the plurality of second transformation kernel candidates, and then an index specifying one of the second transformation kernel candidates may be encoded. Here, each of the plurality of second transformation kernel candidates may differ in at least one of the size or coefficient.
[0947] Alternatively, based on the size of the current block, the size of the second transformation kernel may be determined, and an index specifying one of a plurality of second transformation kernel candidates having the determined size may be encoded.
[0948] In the example illustrated in FIGS. 77 and 78, a second transformation kernel is shown to be used in which the number of rows and the number of columns are the same. To simplify the second transformation, it is also possible to set the number of rows and the number of columns differently.
[0949] FIGS. 79 and FIGS. 80 illustrate a second transformation based on an asymmetric form second transformation kernel.
[0950] The number of rows R of the second transformation kernel can be set to a value smaller than the number of columns N. For example, the number of rows R can be set to 8 and the number of columns N can be set to 48.
[0951] If the number of rows of the second transformation kernel decreases, the number of second transformation coefficients output as a result of the second transformation also decreases. For example, if a matrix multiplication is performed between an 8x48 second transformation kernel and a 48x1 input matrix, 8x1 second transformation coefficients are generated.
[0952] The eight second transformation coefficients can be rearranged within an 8x8 block. In this case, within the application area of the second transformation (i.e., the area containing the first transformation coefficients to which the second transformation is applied), the values of the transformation coefficients can be set to 0 in the areas where the second transformation coefficients are not assigned. For example, if the application area of the second transformation is a polygonal shape area containing 48 samples, the values of the transformation coefficients can be set to 0 in the remaining areas of the polygonal shape area excluding the areas where the eight second transformation coefficients are assigned.
[0953] In regions where the second transformation is not applied, the first transformation coefficients can be maintained as they are.
[0954] Alternatively, at least some of the first transformation coefficients within the region where the second transformation is not applied can be encoded by converting them to zero. FIG. 80 illustrates an example in which at least some of the region where the second transformation is not applied is converted to zero.
[0955] As shown in the example illustrated in FIG. 80 (a), the values of the first transformation coefficients corresponding to the high-frequency region within the region where the second transformation is not performed can be converted to 0. For example, the values of the first transformation coefficients where the sum of the x-axis and y-axis coordinates is greater than or equal to a threshold value can be converted to 0.
[0956] Alternatively, depending on a specific form, first transformation coefficients that are converted to zero may be selected. For example, as shown in the example illustrated in FIG. 80 (b), the first transformation coefficients included in the bottom n rows within the region where the second transformation is not performed may be converted to zero. Alternatively, as shown in the example illustrated in FIG. 80 (c), the first transformation coefficients included in the right n columns within the region where the second transformation is not performed may be converted to zero.
[0957] Alternatively, as in the example shown in (d) of FIG. 80, all first transformation coefficients within the region where the second transformation is not performed may be transformed to 0.
[0958] The shape of the region containing first transformation coefficients that are converted to 0 may be determined based on at least one of the current block size, shape, intra prediction mode, or transformation kernel. Alternatively, an index that specifies one of a plurality of candidate shapes that matches the region may be encoded and signaled.
[0959] Whether a second conversion is permitted can be determined based on at least one of the encoding mode of the current block or the first conversion kernel. Here, the encoding mode refers to intra-prediction or inter-prediction. For example, if the current block is encoded with intra-prediction, a second conversion is permitted, whereas if the current block is encoded with inter-prediction, a second conversion may not be permitted.
[0960] Information indicating whether the second transformation has been applied may be encoded and signaled. The information may be a 1-bit flag. Depending on whether the flag is true or false, it may be determined whether the second transformation has been applied to the current block. Alternatively, the information may be index information. An index value of 0 indicates that the second transformation has not been applied to the current block. Conversely, an index value greater than 0 indicates that the second transformation has been applied to the current block. When the index value is greater than 0, the second transformation kernel can be identified by the index.
[0961] Information indicating whether a second transformation has been performed on the current block can be encoded individually for each color componen...
Claims
1. A step for inducing movement information of the current block; and Based on the above movement information, the method includes the step of obtaining a predicted block of the current block, The above movement information is derived from the list of movement information merge candidates of the above current block, and The above list of motion information merging candidates includes temporal motion information merging candidates, and A video decoding method characterized in that the above-mentioned temporal motion information merging candidate is derived based on the motion information of the location candidate with the smallest template matching cost among a plurality of location candidates within a collocated picture.
2. In Paragraph 1, The plurality of position candidates includes a first position candidate existing inside a collocated area within the collocated picture and a second position candidate existing outside the collocated area. A video decoding method characterized in that the above-mentioned collocated region has the same size and position as the current block within the above-mentioned collocated picture.
3. In Paragraph 2, A video decoding method characterized in that the plurality of temporal position candidates include a third position candidate indicated by the initial motion vector of the current block within the collocated picture.
4. In Paragraph 3, An image decoding method characterized in that the above initial motion vector is derived from a sample at a position adjacent to the current block.
5. In Paragraph 1, An image decoding method characterized in that the above template matching cost is calculated based on the template of the current block and a reference template specified by the movement information of the location candidate.
6. In Paragraph 5, The movement information of the above-mentioned location candidates is changed to match the target reference picture, and An image decoding method characterized by the reference template being specified by the changed movement information of the above-mentioned location candidate.
7. In Paragraph 5, The movement information of the above-mentioned position candidates is corrected based on scaling parameters, and An image decoding method characterized by the reference template being specified by the corrected motion information of the above-mentioned location candidate.
8. In Paragraph 7, A video decoding method characterized in that the scaling parameter is determined based on the distance between the collocated picture and the target reference picture and the distance between the collocated picture and the reference picture indicated by the motion information of the position candidate.
9. In Paragraph 1, The above image decoding method further includes the step of updating the prediction block, and An image decoding method characterized in that the updated prediction block is obtained by performing transformation and inverse transformation on the prediction block.
10. In Paragraph 9, An image decoding method characterized in that the above transformation and the above inverse transformation are performed on a transformation target region including the above prediction block.
11. In Paragraph 10, An image decoding method characterized in that the size of the conversion target area is adaptively determined according to the size of the current block.
12. In Paragraph 11, An image decoding method characterized in that at least one of the transformation coefficients obtained by the above transformation is changed to 0.
13. In Paragraph 11, The above prediction block has an expanded size compared to the above current block, and An image decoding method characterized in that, among the samples output through the transformation and the inverse transformation within the transformation target area, an area of the same size as the current block is set as the updated prediction block.
14. A step for inducing movement information of the current block; and Based on the above movement information, the method includes the step of obtaining a predicted block of the current block, The above movement information is derived from the list of movement information merge candidates of the above current block, and The above list of motion information merging candidates includes temporal motion information merging candidates, and A video encoding method characterized in that the above-mentioned temporal motion information merging candidate is derived based on the motion information of the location candidate with the smallest template matching cost among a plurality of location candidates within a collocated picture.
15. A processor for acquiring compressed video data; and It includes a transmission unit that transmits the above-mentioned compressed video data, The above compressed video data is, A step for inducing movement information of the current block; and Based on the above movement information, it is obtained through the step of obtaining the predicted block of the above current block, and The above movement information is derived from the list of movement information merge candidates of the above current block, and The above list of motion information merging candidates includes temporal motion information merging candidates, and A device for transmitting compressed video data, characterized in that the above-mentioned temporal motion information merging candidate is derived based on the motion information of the location candidate with the smallest template matching cost among a plurality of location candidates within a collocated picture.