Image signal encoding / decoding method and apparatus therefor

By partitioning the picture into multiple parallel blocks and determining the striped partition structure, the problem of low encoding efficiency of video signals in the prior art is solved, and higher compression rate and encoding efficiency in high-definition video services are achieved.

CN119835418APending Publication Date: 2025-04-15KONINKLIJKE PHILIPS NV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411987721.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-12-31
Filing Date
2020-09-10
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

Existing video encoding technology faces the problems of large data volume and low compression rate in high-definition video services, especially the performance of HEVC has gradually shown limitations.

Method used

By partitioning the picture into multiple parallel blocks and determining the strip partition structure based on the parallel block partition structure, efficient encoding and decoding of the video signal is achieved.

Benefits of technology

It improves the encoding/decoding efficiency of video signals, enhances video compression performance, and is suitable for the needs of high-definition video services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119835418A_ABST
    Figure CN119835418A_ABST
Patent Text Reader

Abstract

An image signal encoding / decoding method and an apparatus therefor according to the present disclosure. The image decoding method comprises the steps of: parsing parallel block column number information indicating a value obtained by subtracting 1 from the number of parallel block columns included in an i-th slice; parsing parallel block line number information indicating a value obtained by subtracting 1 from the number of parallel block lines included in the i-th slice; and if both the parallel block column number information and the parallel block row number information are zero, further parsing number information related to the number of slices for which height information in the parallel block including the i-th slice is explicitly signaled.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the application date of September 10, 2020, application number 202080028560.1, and invention name “Image signal encoding / decoding method and device thereof”. Technical Field

[0002] The present disclosure relates to a video signal encoding / decoding method and a device thereof. Background Art

[0003] As display panels become larger, higher quality video services are required. The biggest problem with high-definition video services is that the amount of data has greatly increased. In order to solve the above problems, research on improving video compression rates is being actively conducted. As a representative example, the Joint Collaboration Team on Video Coding (JCT-VC) was established in 2009 by the Moving Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) under the International Telecommunication Union-Telecommunication (ITU-T). JCT-VC proposed High Efficiency Video Coding (HEVC), a video compression standard with a compression performance that is about twice that of H.264 / AVC and was approved as a standard on January 25, 2013. However, with the rapid development of high-definition video services, the performance of HEVC has gradually shown its limitations. Summary of the invention

[0004] Technical Purpose

[0005] An object of the present disclosure is to provide a method of partitioning a picture into a plurality of tiles when encoding / decoding a video signal and an apparatus for performing the method.

[0006] An object of the present disclosure is to provide a method for determining a slice partition structure based on a tile partition structure when encoding / decoding a video signal and an apparatus for performing the method.

[0007] An object of the present disclosure is to provide a method of partitioning a picture into a plurality of sub-pictures when encoding / decoding a video signal and an apparatus for performing the method.

[0008] The technical effects of the present disclosure may not be limited to the above-mentioned effects, and a person of ordinary skill in the technical field to which the present disclosure belongs may clearly understand other unmentioned technical effects from the following description.

[0009] Technical Solution

[0010] A video signal decoding method according to the present disclosure includes: parsing the number information of parallel block columns representing the value obtained by subtracting 1 from the number of parallel block columns included in the i-th band, parsing the number information of parallel block rows representing the value obtained by subtracting 1 from the number of parallel block rows included in the i-th band, and when the number information of the parallel block columns and the number information of the parallel block rows are both 0, further parsing the number information related to the number of stripes in which height information in the parallel blocks including the i-th stripe is explicitly sent with a signal.

[0011] In the video signal decoding method according to the present disclosure, when the sequence number of the first slice in the tile is smaller than the number of the slices, first height information related to the height of the first slice may be additionally parsed.

[0012] In the video signal decoding method according to the present disclosure, when the sequence number of the second slice in the tile is equal to or greater than the number of the slices, the height information for the second slice may not be parsed.

[0013] In the video signal decoding method according to the present disclosure, the height of the second slice may be set to a minimum value between a first height value derived based on height information last signaled and a second height value excluding an area occupied by a previous slice in the tile.

[0014] In the video signal decoding method according to the present disclosure, the variable i may be updated to a value obtained by adding a value obtained by subtracting 1 from the number of slices.

[0015] The features briefly summarized above with respect to the present disclosure are merely illustrative aspects of the detailed description of the present disclosure that is described later and do not limit the scope of the present disclosure.

[0016] Technical Effects

[0017] According to the present disclosure, encoding / decoding efficiency may be improved by partitioning a picture into a plurality of tiles.

[0018] According to the present disclosure, encoding / decoding efficiency may be improved by determining a slice partition structure based on a tile partition structure.

[0019] According to the present disclosure, encoding / decoding efficiency may be improved by partitioning a picture into a plurality of sub-pictures.

[0020] Effects obtainable from the present disclosure may not be limited to the above-mentioned effects, and other unmentioned effects may be clearly understood from the following description by a person of ordinary skill in the technical field to which the present disclosure pertains. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1is a diagram illustrating a block diagram of a video encoding device (encoder) according to an embodiment of the present disclosure.

[0022] Figure 2 is a diagram showing a block diagram of a video decoding device (decoder) according to an embodiment of the present disclosure.

[0023] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.

[0024] Figure 4 is a diagram illustrating various partition types of a coding block.

[0025] Figure 5 is a diagram illustrating an example of aspects of partitioning a CTU.

[0026] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.

[0027] Figure 7 is a flow chart of a process for deriving motion information for a current block in merge mode.

[0028] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.

[0029] Fig. 9 is a diagram illustrating candidate blocks for deriving merge candidates.

[0030] Fig.10 is a diagram for explaining the updating aspect of the motion information table.

[0031] Fig.11 is a diagram illustrating an updating aspect of a motion information table.

[0032] Fig.12 : is a diagram showing an example of updating the index of the saved motion information candidate.

[0033] Fig.13 is a diagram showing the positions of representative sub-blocks.

[0034] Fig.14 is a diagram showing an example in which a redundancy check is performed only on a part of merging candidates.

[0035] Fig.15 is a diagram showing an example in which a redundancy check on a specific merge candidate is omitted.

[0036] Fig.16 is a diagram showing an example in which a candidate block included in the same merge processing region as a current block is set to be unusable as a merge candidate.

[0037] Fig.17is a diagram illustrating an example of deriving a merge candidate for a current block when the current block is included in a merge processing region.

[0038] Fig.18 is a diagram showing a temporary motion information table.

[0039] Fig.19 is a diagram showing an example of making the motion information table and the temporary motion information table consistent.

[0040] Fig. 20 is a flowchart of an intra-frame prediction method according to an embodiment of the present disclosure.

[0041] Fig.21 is a diagram showing an intra prediction mode.

[0042] Fig. 22 and Fig.23 is a diagram showing an example of a one-dimensional array in which reference samples are arranged in one row.

[0043] Fig.24 is a diagram showing an angle formed by a directional intra prediction mode and a straight line parallel to the x-axis.

[0044] Fig.25 is a diagram illustrating an aspect of obtaining prediction samples when a current block has a non-square shape.

[0045] Fig.26 is a diagram illustrating a wide-angle intra prediction mode.

[0046] Fig. 27 : is a diagram showing an example of partitioning in a vertical direction and partitioning in a horizontal direction.

[0047] Fig.28 is a diagram illustrating an example of determining a partition shape of a coding block.

[0048] Fig.29 is a diagram illustrating an example of determining a partition shape of a coding block.

[0049] Fig.30 is a diagram illustrating an example of determining whether transform skip is performed per subblock.

[0050] Fig.31 is a diagram showing an example in which sub-blocks use the same transform type.

[0051] Fig.32 and Fig.33 is a diagram illustrating application aspects of the sub-transform block coding method.

[0052] Fig.34 and Fig.35A horizontal direction transform type and a vertical direction transform type according to the position of a subblock that is a transform target are shown.

[0053] Fig.36 is a diagram showing aspects of encoding of transform coefficients when the reduction factor is 16.

[0054] Fig.37 and Fig.38 is a diagram showing a region that is a target of the second transformation.

[0055] Fig.39 is an example showing various non-separable transformation matrix candidates.

[0056] Fig.40 is a diagram illustrating a screen partitioning method according to an embodiment of the present disclosure.

[0057] Fig.41 An example in which a screen is partitioned into a plurality of tiles is shown.

[0058] Fig.42 is a diagram for describing an aspect in which size information of a slice is signaled.

[0059] Fig.43 and Fig.44 is a diagram used to describe the encoding aspects of the height information of a slice.

[0060] Fig.45 is a diagram for describing partition shapes that can be applied to a screen.

[0061] Fig.46 is a flowchart of a method for partitioning a screen into at least one sub-screen according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0062] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.

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

[0064] Hereinafter, the encoding / decoding target block is referred to as a “current block.” In an example, the current block may refer to a coding block, a transform block, or a prediction block according to a current process of encoding / decoding.

[0065] In addition, the term "unit" used in this specification means a basic unit for performing a specific encoding / decoding process, and "block" can be understood to mean a sample array having a predetermined size. Unless otherwise specified, "block" and "unit" can be used interchangeably. In examples, in the examples described later, the coding block and the coding unit can be understood to have the same meaning as each other.

[0066] Figure 1 is a diagram showing a block diagram of an image encoding device (encoder) according to an embodiment of the present disclosure.

[0067] Reference Figure 1 , the image encoding apparatus 100 may include a picture partition unit 110, prediction units 120 and 125, a transform unit 130, a quantization unit 135, a rearrangement unit 160, an entropy encoding unit 165, an inverse quantization unit 140, an inverse transform unit 145, a filter unit 150, and a memory 155.

[0068] Figure 1 The components described in the figure are shown independently in order to illustrate different characteristic functions in the image encoding device, and the figure does not indicate that each component is composed of a separate hardware or a software unit. That is, each component is listed only for the convenience of explanation, and at least two of the components may constitute one component, or one component may be divided into multiple components that can perform its functions. Even embodiments in which the components are integrated and embodiments in which the components are divided are included in the scope of the present disclosure unless they depart from the spirit of the present disclosure.

[0069] In addition, some components are not necessary parts for performing the necessary functions of the present disclosure, but are optional components only for improving performance. The present disclosure can be implemented using necessary components for realizing the spirit of the present disclosure other than components only for improving performance, and a structure including only necessary components other than optional components only for improving performance is also included in the scope of the present disclosure.

[0070] The picture partition unit 110 may partition an input picture into at least one processing unit. In this regard, a processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). In the picture partition unit 110, a single picture may be partitioned into a combination of a plurality of coding units, prediction units, and transform units, and the picture may be encoded by selecting a combination of coding units, prediction units, and transform units according to a predetermined condition (e.g., a cost function).

[0071] For example, a single picture may be partitioned into a plurality of coding units. In order to partition a picture into coding units, a recursive tree structure such as a quadtree structure may be used, and a coding unit derived from a root such as a single image or a maximum coding unit may be partitioned into other coding units and may have as many child nodes as the partitioned coding units. Coding units that are no longer partitioned according to certain restrictions become leaf nodes. That is, when it is assumed that only square partitions are available for a single coding unit, a single coding unit may be partitioned into up to four other coding units.

[0072] Hereinafter, in an embodiment of the present disclosure, a coding unit may be used as a unit for encoding or may be used as a unit for decoding.

[0073] The prediction units may be obtained by partitioning a single coding unit into at least one square or rectangle having the same size, or may be partitioned into prediction units in such a manner that one prediction unit may be different in shape and / or size from another prediction unit.

[0074] When a prediction unit is generated based on a coding block on which intra prediction is being performed, when the coding unit is not a minimum coding unit, intra prediction may be performed without performing partitioning into a plurality of N×N prediction units.

[0075] The prediction units 120 and 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 be determined whether inter-frame prediction or intra-frame prediction is performed on the prediction unit, and detailed information (e.g., intra-frame prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. In this regard, the processing unit on which the prediction is performed may be different from the processing unit in which the prediction method and its details are determined. For example, the prediction method, prediction mode, etc. may be determined based on the prediction unit, and the prediction may be performed based on the transform unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transform unit 130. In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded by the entropy encoding unit 165 using the residual value and may be sent to the decoder. When a specific encoding mode is used, the original block is encoded as it is without generating a prediction block through the prediction unit 120 or 125 and is sent to the decoding unit.

[0076] The inter-frame prediction unit 120 may predict the prediction unit based on information about at least one of a previous picture and a subsequent picture of the current picture, or in some cases, may predict the prediction unit based on information about some coding regions in 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.

[0077] The reference picture interpolation unit may receive reference picture information from the memory 155 and generate pixel information of integer pixels or smaller pixels from the reference picture. In the case of luma pixels, an 8-tap DCT-based interpolation filter with different coefficients may be used to generate pixel information about integer pixels or smaller pixels for 1 / 4 pixel units. In the case of chroma signals, a 4-tap DCT-based interpolation filter with different filter coefficients may be used to generate pixel information about integer pixels or smaller pixels for 1 / 8 pixel units.

[0078] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolation unit. As a method for calculating a motion vector, various methods may be used, such as a full search based block matching algorithm (FBMA), a three-step search (TSS) algorithm, a new three-step search (NTS) algorithm, and the like. Based on the interpolated pixels, the motion vector may have a motion vector value in units of 1 / 2 pixels or 1 / 4 pixels. The motion prediction unit may predict the current prediction unit by changing the motion prediction method. As a motion prediction method, various methods may be used, such as a skip method, a merge method, an advanced motion vector prediction (AMVP) method, an intra-block copy method, and the like.

[0079] The intra prediction unit 125 may generate a prediction unit based on information about reference pixels around the current block (which is pixel information in the current picture). When the neighboring block of the current prediction unit is a block on which inter prediction is performed, and therefore the reference pixel is a pixel on which inter prediction is performed, the reference pixel included in the block on which inter prediction is performed may be replaced by information about the reference pixel of the neighboring block on which intra prediction is performed. In other words, when the reference pixel is unavailable, at least one reference pixel among the available reference pixels may be used to replace the unavailable reference pixel information.

[0080] The prediction mode in the intra prediction may include a directional prediction mode using reference pixel information according to a prediction direction and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luma information may be different from the mode for predicting chroma information. In order to predict chroma information, information about the intra prediction mode for predicting luma information or information about the predicted luma signal may be used.

[0081] When performing intra prediction, when the size of the prediction unit is the same as the transform unit, intra prediction can be performed on the prediction unit based on pixels located to the left, above the left, and above the prediction unit. However, when performing intra prediction, when the size of the prediction unit is different from the transform unit, intra prediction can be performed based on the transform unit by using reference pixels. In addition, intra prediction using N×N partitions can be used only for the minimum coding unit.

[0082] In the intra prediction method, a prediction block may be generated after an adaptive intra smoothing (AIS) filter is applied to reference pixels according to a prediction mode. The type of the AIS filter applied to the reference pixels may vary. In order to perform the intra prediction method, an intra prediction mode for a current prediction unit may be predicted from intra prediction modes of prediction units existing around the current prediction unit. When the prediction mode for the current prediction unit is predicted by using mode information predicted from neighboring prediction units, when the intra prediction mode for the current prediction unit is the same as the intra prediction mode of the neighboring prediction unit, information indicating that the current prediction unit and the neighboring prediction unit have the same prediction mode may be sent by using predetermined flag information. When the prediction mode for the current prediction unit is different from the prediction mode of the neighboring prediction unit, entropy coding may be performed to encode information about the prediction mode for the current block.

[0083] Also, a residual block including information on a residual value which is a difference value between a prediction unit predicted by the prediction unit 120 or 125 and an original block of the prediction unit may be generated. The generated residual block may be input to the transform unit 130.

[0084] The transform unit 130 may perform a transform on a residual block by using a transform method such as a discrete cosine transform (DCT) or a discrete sine transform (DST), wherein the residual block includes information about a residual value between an original block and a prediction unit generated by the prediction unit 120 or 125. In this regard, the DCT transform kernel includes at least one of DCT2 or DCT8, and the DST transform kernel includes DST7. Whether to apply DCT or DST in order to perform a transform on the residual block may be determined based on information about an intra prediction mode of a prediction unit used to generate the residual block. The transform for the residual block may be skipped. A flag indicating whether to skip the transform for the residual block may be encoded. Transform skipping may be allowed for a residual block whose size is less than or equal to a threshold, a residual block of a luminance component, or a residual block of a chrominance component in a 4:4:4 format.

[0085] The quantization unit 135 may perform quantization on the value transformed into the frequency domain by the transformation unit 130. The quantization coefficient may vary according to the importance of the block or image. The value calculated in the quantization unit 135 may be provided to the inverse quantization unit 140 and the rearrangement unit 160.

[0086] The rearrangement unit 160 may perform rearrangement on coefficient values ​​with respect to the quantized residual values.

[0087] The rearrangement unit 160 may change the coefficients in the two-dimensional block form into the coefficients in the one-dimensional vector form by a coefficient scanning method. For example, the rearrangement unit 160 may scan from the DC coefficient to the coefficients in the high frequency domain by using a zigzag scanning method so as to change the coefficients into the form of a one-dimensional vector. Depending on the size of the transform unit and the intra-frame prediction mode, vertical scanning or horizontal scanning may be used instead of zigzag scanning, wherein the coefficients in the two-dimensional block form are scanned in the column direction in the vertical scanning and the coefficients in the two-dimensional block form are scanned in the row direction in the horizontal scanning. In other words, which scanning method to use among zigzag scanning, vertical scanning, and horizontal scanning may be determined according to the size of the transform unit and the intra-frame prediction mode.

[0088] The entropy encoding unit 165 may perform entropy encoding based on the value calculated by the rearrangement unit 160. The entropy encoding may use various encoding methods, for example, exponential Golomb coding, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC).

[0089] The entropy coding unit 165 may encode various types of information obtained from the rearrangement unit 160 and the prediction units 120 and 125 (such as information about residual value coefficients and information about block types of coding units, information about prediction modes, information about partition units, information about prediction units and information about transform units, information about motion vectors, information about reference frames, information about block interpolation, filtering information, and the like).

[0090] The entropy encoding unit 165 may entropy encode coefficients of the coding unit input from the rearrangement unit 160 .

[0091] The inverse quantization unit 140 may perform inverse quantization on the value quantized in the quantization unit 135, and the inverse transform unit 145 may perform inverse transform on the value transformed in the transform unit 130. The residual value generated by the inverse quantization unit 140 and the inverse transform unit 145 may be added to the prediction unit predicted by the motion estimation unit, the motion compensation unit, or the intra prediction unit included in the prediction units 120 and 125 in order to generate a reconstructed block.

[0092] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).

[0093] The deblocking filter can remove block distortion that occurs due to the boundaries between blocks in the reconstructed picture. In order to determine whether to perform deblocking, it can be determined whether to apply the deblocking filter to the current block based on the pixels included in the number of rows and columns included in the block. When the deblocking filter is applied to the block, a strong filter or a weak filter is applied according to the required deblocking filter strength. In addition, when applying the deblocking filter, when horizontal direction filtering and vertical direction filtering are performed, the horizontal direction filtering and the vertical direction filtering can be configured to be processed in parallel.

[0094] The offset correction unit can correct the original image by offsetting in pixels relative to the image on which deblocking is performed. In order to perform offset correction on a specific picture, a method of applying an offset to an area determined after partitioning pixels of the image into a predetermined number of areas or a method of applying an offset according to edge information of each pixel can be used.

[0095] Adaptive loop filtering (ALF) may be performed based on a value obtained by comparing a filtered reconstructed image with an original image. Pixels included in an image may be partitioned into predetermined groups, a filter to be applied to each of the groups may be determined, and filtering may be performed separately for each group. Information on whether ALF is applied may be sent for each coding unit (CU) of a luminance signal, and the shape and filter coefficient of the ALF filter to be applied may vary based on each block. Alternatively, an ALF filter having the same shape (fixed shape) may be applied regardless of the characteristics of the block to which the filter is applied.

[0096] In the memory 155, a reconstructed block or picture calculated by the filter unit 150 may be stored. When inter prediction is performed, the stored reconstructed block or picture may be provided to the prediction unit 120 or 125.

[0097] Figure 2 is a diagram showing a block diagram of an image decoding device (decoder) according to an embodiment of the present disclosure.

[0098] Reference Figure 2 , the image decoding apparatus 200 may include: an entropy decoding unit 210 , a rearrangement unit 215 , an inverse quantization unit 220 , an inverse transform unit 225 , prediction units 230 and 235 , a filter unit 240 , and a memory 245 .

[0099] When an image bitstream is input from an encoder, the input bitstream may be decoded according to an inverse process of the image encoding apparatus.

[0100] The entropy decoding unit 210 may perform entropy decoding according to an inverse process of entropy encoding performed by an entropy encoding unit of an image encoder. For example, in association with a method performed by an image encoder device, various methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC) may be applied.

[0101] The entropy decoding unit 210 may decode information about intra prediction and inter prediction performed by the encoder.

[0102] The rearrangement unit 215 may perform rearrangement on the bitstream entropy-decoded by the entropy decoding unit 210 based on the rearrangement method used in the encoder. Coefficients represented in the form of a one-dimensional vector may be reconstructed and rearranged into coefficients in the form of a two-dimensional block. The rearrangement unit 215 may perform rearrangement by receiving information related to coefficient scanning performed in the encoder and performing inverse scanning based on the scanning order performed in the encoder.

[0103] The inverse quantization unit 220 may perform inverse quantization based on the quantization parameter received from the encoder and the coefficient value of the rearranged block.

[0104] The inverse transform unit 225 may perform an inverse transform (i.e., inverse DCT or inverse DST) opposite to the transform (i.e., DCT or DST) performed on the quantization result by the transform unit in the image encoder. In this regard, the DCT transform core may include at least one of DCT2 or DCT8, and the DST transform core may include DST7. Optionally, when the transform is skipped in the image encoder, the inverse transform is not performed in the inverse transform unit 225. The inverse transform may be performed based on the transform unit determined by the image encoder. The inverse transform unit 225 of the image decoder may selectively perform a transform method (e.g., DCT or DST) according to a plurality of pieces of information such as a prediction method, a size of a current block, a prediction direction, etc.

[0105] The prediction unit 230 or 235 may generate a prediction block based on information related to the prediction block received from the entropy decoding unit 210 and information about a previously decoded block or picture received from the memory 245 .

[0106] As described above, as an operation of the image encoder, when intra prediction is performed, when the size of the prediction unit is the same as the transform unit, intra prediction may be performed on the prediction unit based on pixels located to the left, above the left, and above the prediction unit. However, when intra prediction is performed, when the size of the prediction unit is different from the transform unit, intra prediction may be performed based on the transform unit by using reference pixels. In addition, intra prediction using N×N partitions may be used only for the minimum coding unit.

[0107] The prediction units 230 and 235 may include a PU determination module, an inter prediction unit, and an intra prediction unit. The PU determination module may receive various types of information (such as information about the prediction unit, information about the prediction mode of the intra prediction method, information about the motion prediction of the inter prediction method, etc.) input from the entropy decoding unit 210, divide the prediction unit in the current coding unit, and determine whether to perform inter prediction or intra prediction on the prediction unit. By using the information required in the inter prediction of the current prediction unit received from the image encoder, the inter prediction unit 230 may perform inter prediction on the current prediction unit based on information about at least one of a previous picture and a subsequent picture of the current picture including the current prediction unit. Optionally, inter prediction may be performed based on information about some pre-reconstructed areas in the current picture including the current prediction unit.

[0108] In order to perform inter prediction, which method of the skip mode, the merge mode, the AMVP mode, or the intra block copy mode to use as a motion prediction method for a prediction unit included in the coding unit may be determined based on the coding unit.

[0109] The intra prediction unit 235 may generate a prediction block based on information about pixels within the current picture. When the prediction unit is a prediction unit for which intra prediction has been performed, intra prediction may be performed based on information about the intra prediction mode of the prediction unit received from the image encoder. The intra prediction unit 235 may include an adaptive intra smoothing (AIS) filter, a reference pixel interpolation module, or a DC filter. The AIS filter may perform filtering on the reference pixels of the current block, and may determine whether to apply the filter based on the prediction mode for the current prediction unit. When AIS filtering is performed on the reference pixels of the current block, information about the AIS filter received from the image encoder and the prediction mode of the prediction unit may be used. When the prediction mode for the current block is a mode in which AIS filtering is not applied, the AIS filter may not be applied.

[0110] When the prediction mode of the prediction unit is a prediction mode in which intra prediction is performed based on a pixel value obtained by interpolating reference pixels, the reference pixel interpolation unit may interpolate the reference pixels so as to generate reference pixels having an integer or smaller unit. When the prediction mode for the current prediction unit is a prediction mode in which a prediction block is generated without interpolating reference pixels, the reference pixels may not be interpolated. When the prediction mode for the current block is a DC mode, a DC filter may generate a prediction block by filtering.

[0111] The reconstructed block or the reconstructed picture may be provided to the filter unit 240. The filter unit 240 may include a deblocking filter, an offset correction module, and an ALF.

[0112] Information about whether a deblocking filter has been applied to a corresponding block or a corresponding picture and information about whether a strong filter or a weak filter is applied when the deblocking filter is applied may be received from the image encoder. A deblocking filter of an image decoder may receive information about the deblocking filter from the image encoder, and the image decoder may perform deblocking filtering on the corresponding block.

[0113] The offset correction unit may perform offset correction on the reconstructed image based on the type of offset correction applied to the image when encoding is performed, information about the offset value, and the like.

[0114] ALF may be applied to the coding unit based on information on whether ALF is applied, information on an ALF coefficient, etc. received from the encoder. The above ALF information may be provided by being included in a specific parameter set.

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

[0116] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.

[0117] The largest coding block may be defined as a coding tree block. A single picture may be partitioned into a plurality of coding tree units (CTUs). A CTU may be a coding unit of the largest size and may be referred to as a largest coding unit (LCU). Figure 3 is a diagram illustrating an example of partitioning a single picture into a plurality of CTUs.

[0118] The size of a CTU may be defined at a picture level or a sequence level. Similarly, information indicating the size of a CTU may be signaled via a picture parameter set or a sequence parameter set.

[0119] In an example, the size of the CTU for the entire picture within the sequence may be set to 128×128. Alternatively, any one of 128×128 or 256×256 may be determined as the size of the CTU at the picture level. In an example, the CTU may be set to have a size of 128×128 in the first picture and a size of 256×256 in the second picture.

[0120] The coding block may be generated by partitioning the CTU. The coding block represents a basic unit for performing encoding / decoding. In an example, prediction or transformation may be performed for each coding block, or a prediction coding mode may be determined for each coding block. In this regard, the prediction coding mode represents a method for generating a predicted image. In an example, the prediction coding mode may include intra prediction, inter prediction, current picture reference (CPR), intra block copy (IBC), or combined prediction. For a coding block, a prediction block of the coding block may be generated by using a prediction coding mode of at least one of intra prediction, inter prediction, current picture reference, or combined prediction.

[0121] Information indicating the prediction coding mode for the current block may be signaled in a bitstream. In an example, the information may be a 1-bit flag indicating whether the prediction coding mode is an intra mode or an inter mode. When the prediction coding mode for the current block is determined to be an inter mode, current picture reference or combined prediction may be available.

[0122] The current picture reference sets the current picture as the reference picture, and obtains the prediction block of the current block from the area within the current picture that has been encoded / decoded. In this regard, the current picture refers to the picture that includes the current block. Information indicating whether the current picture reference is applied to the current block can be signaled in a bitstream. In an example, the information can be a 1-bit flag. When the flag is true, the prediction coding mode for the current block can be determined as the current picture reference, and when the flag is false, the prediction coding mode for the current block can be determined as inter-frame prediction.

[0123] Alternatively, the prediction coding mode of the current block may be determined based on the reference picture index. In an example, when the reference picture index indicates the current picture, the prediction coding mode for the current block may be determined as the current picture reference. When the reference picture index indicates a picture other than the current picture, the prediction coding mode for the current block may be determined as the inter-frame prediction. In other words, the current picture reference is a prediction method using information about an already encoded / decoded area within the current picture, and the inter-frame prediction is a prediction method using information about another already encoded / decoded picture.

[0124] Combined prediction refers to a combined coding mode that combines at least two of intra prediction, inter prediction, and current picture reference. In the example, when combined prediction is applied, a first prediction block may be generated based on any one of intra prediction, inter prediction, or current picture reference, and a second prediction block may be generated based on another one of intra prediction, inter prediction, or current picture reference. When the first prediction block and the second prediction block are generated, a final prediction block may be generated by calculating an average or weighted sum of the first prediction block and the second prediction block. Information indicating whether combined prediction is applied to the current block may be signaled in a bitstream. The information may be a 1-bit flag.

[0125] Figure 4 is a diagram illustrating various partition types of a coding block.

[0126] The coding block may be partitioned into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning. The partitioned coding block may be partitioned again into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning.

[0127] Quadtree partitioning represents a method of partitioning the current block into four blocks. As a result of quadtree partitioning, the current block can be partitioned into four square partitions (refer to Figure 4 of "SPLIT_QT").

[0128] Binary tree partitioning refers to a method of partitioning a current block into two blocks. An operation of partitioning a current block into two blocks along a vertical direction (i.e., using a vertical line passing through the current block) may be referred to as a vertical binary tree partitioning, and an operation of partitioning a current block into two blocks along a horizontal direction (i.e., using a horizontal line passing through the current block) may be referred to as a horizontal binary tree partitioning. As a result of the binary tree partitioning, the current block may be partitioned into two non-square partitions. Figure 4 "SPLIT_BT_VER" is a diagram showing the result of binary tree partitioning in the vertical direction, and Figure 4 “SPLIT_BT_HOR” is a diagram showing the result of binary tree partitioning in the horizontal direction.

[0129] Ternary tree partitioning means a method of partitioning a current block into three blocks. An operation of partitioning a current block into three blocks along a vertical direction (i.e., using two vertical lines passing through the current block) may be referred to as vertical ternary tree partitioning, and an operation of partitioning a current block into three blocks along a horizontal direction (i.e., using two horizontal lines passing through the current block) may be referred to as horizontal ternary tree partitioning. As a result of the ternary tree partitioning, the current block may be partitioned into three non-square partitions. In this regard, the width / height of the partition located at the center of the current block may be twice the width / height of the other partitions. Figure 4"SPLIT_TT_VER" is a diagram showing the result of the vertical ternary tree partitioning, and Figure 4 “SPLIT_TT_HOR” is a diagram showing the result of ternary tree partitioning in the horizontal direction.

[0130] The number of partitions of a CTU may be defined as a partition depth. The maximum partition depth of a CTU may be determined at a sequence level or a picture level. Thus, the maximum partition depth of a CTU may vary based on a sequence or a picture.

[0131] Optionally, the maximum partition depth may be determined independently for each partitioning method. In an example, the maximum partition depth allowed for quadtree partitioning may be different from the maximum partition depth allowed for binary tree partitioning and / or ternary tree partitioning.

[0132] The encoder may signal information indicating at least one of a partition type and a partition depth of the current block in a bitstream, and the decoder may determine a partition type and a partition depth of the CTU based on the information obtained by parsing the bitstream.

[0133] Figure 5 is a diagram illustrating an example of aspects of partitioning a CTU.

[0134] An operation of partitioning a coding block by using quadtree partitioning, binary tree partitioning, and / or ternary tree partitioning may be referred to as multi-tree partitioning.

[0135] A coding block generated by partitioning a coding block by applying multi-tree partitioning may be referred to as a sub coding block. When the partition depth of the coding block is k, the partition depth of the sub coding block is set to k+1.

[0136] On the contrary, for a coding block having a partition depth of k+1, a coding block having a partition depth of k may be referred to as a parent coding block.

[0137] The partition type of the current coding block may be determined based on at least one of the partition type of the parent coding block and the partition type of the adjacent coding block. In this regard, the adjacent coding block may be a block adjacent to the current coding block, and includes at least one of an upper adjacent block, a left adjacent block, or an adjacent block adjacent to the upper left corner of the current coding block. In this regard, the partition type may include whether quadtree partitioning is applied, whether binary tree partitioning is applied, the direction of binary tree partitioning, whether ternary tree partitioning is applied, or the direction of ternary tree partitioning.

[0138] In order to determine the partition type of the coding block, information indicating whether the coding block is partitioned may be signaled in the bitstream. This information is a 1-bit flag "split_cu_flag", and when the flag is true, it may indicate that the coding block is partitioned by a multi-tree partitioning method.

[0139] When split_cu_flag is true, information indicating whether the coding block is partitioned by quadtree partitioning may be signaled in the bitstream. This information is a 1-bit flag split_qt_flag, and when this flag is true, the coding block may be partitioned into four blocks.

[0140] In the example, Figure 5 In the example shown in , the CTU is partitioned by quadtree partitioning, and thus four coding blocks with a partition depth of 1 are generated. In addition, it is shown that quadtree partitioning is applied again to the first coding block and the fourth coding block of the four coding blocks generated by quadtree partitioning. As a result, four coding blocks with a partition depth of 2 can be generated.

[0141] In addition, by applying quadtree partitioning again to the coding block with a partition depth of 2, a coding block with a partition depth of 3 may be generated.

[0142] When quadtree partitioning is not applied to a coding block, it may be determined whether to perform binary tree partitioning or ternary tree partitioning for the coding block according to at least one of the size of the coding block, whether the coding block is located at a picture boundary, the maximum partition depth, or the partition type of the neighboring block. When it is determined that binary tree partitioning or ternary tree partitioning is performed for the coding block, information indicating the partition direction may be sent with a bitstream signal. The information may be a 1-bit flag mtt_split_cu_vertical_flag. Based on the flag, it may be determined whether the partition direction is vertical or horizontal. In addition, information indicating which of the binary tree partitioning or ternary tree partitioning is applied to the coding block may be sent with a bitstream signal. The information may be a 1-bit flag mtt_split_cu_binary_flag. Based on the flag, it may be determined whether the binary tree partitioning is applied to the coding block or the ternary tree partitioning is applied to the coding block.

[0143] In the example, Figure 5 In the example shown in , vertical binary tree partitioning is applied to a coding block with a partition depth of 1, vertical ternary tree partitioning is applied to a left coding block in the coding blocks generated by partitioning, and vertical binary tree partitioning is applied to a right coding block.

[0144] Inter prediction is a prediction coding mode that predicts a current block by using information about a previous picture. In an example, a block at the same position as the current block in the previous picture (hereinafter, a co-located block) may be set as a prediction block of the current block. Hereinafter, a prediction block generated based on the co-located block of the current block may be referred to as a co-located prediction block.

[0145] On the contrary, when an object existing in the previous picture has moved to another position in the current picture, the current block can be effectively predicted by using the motion of the object. For example, when the motion direction and size of the object are determined by comparing the previous picture with the current picture, a prediction block (or a prediction image) of the current block can be generated according to the motion information of the object. Hereinafter, the prediction block generated by using the motion information may be referred to as a motion prediction block.

[0146] The residual block may be generated by subtracting the prediction block from the current block. In this regard, in the case where the object moves, the energy of the residual block may be reduced by using the motion prediction block instead of using the co-located prediction block, and thus the compression performance of the residual block may be improved.

[0147] As above, the operation of generating a prediction block by using motion information may be referred to as motion estimation prediction. In most inter predictions, a prediction block may be generated based on motion compensation prediction.

[0148] The motion information may include at least one of a motion vector, a reference picture index, a prediction direction, and a bidirectional weighting factor index. The motion vector represents the motion direction and size of an object. The reference picture index specifies a reference picture of a current block among reference pictures included in a reference picture list. The prediction direction indicates any one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). At least one of L0 direction motion information and L1 direction motion information may be used according to the prediction direction of the current block. The bidirectional weighting factor index specifies a weighting factor applied to an L0 prediction block and a weighting factor applied to an L1 prediction block.

[0149] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.

[0150] Reference Figure 6 The inter-frame prediction method includes: determining an inter-frame prediction mode for a current block (S601), obtaining motion information of the current block according to the determined inter-frame prediction mode (S602), and performing motion compensation prediction for the current block based on the obtained motion information (S603).

[0151] In this regard, the inter prediction mode may refer to various methods for determining motion information of the current block, and include an inter prediction mode using translational motion information, an inter prediction mode using affine motion information. In an example, the inter prediction mode using translational motion information may include a merge mode and a motion vector prediction mode, and the inter prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. The motion information about the current block may be determined based on a neighboring block adjacent to the current block or information obtained by parsing a bitstream.

[0152] The motion information of the current block may be derived from the motion information of another block. In this regard, the other block may be a block that is encoded / decoded by inter-frame prediction before the current block. An operation of setting the motion information of the current block to be the same as the motion information of the other block may be defined as a merge mode. In addition, an operation of setting the motion vector of the other block to a predicted value of the motion vector of the current block may be defined as a motion vector prediction mode.

[0153] Figure 7 is a flow chart of a process for deriving motion information for a current block in merge mode.

[0154] A merge candidate of the current block may be derived S701. The merge candidate of the current block may be derived from a block encoded / decoded by inter prediction before the current block.

[0155] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.

[0156] The candidate block may include at least one of a neighboring block or a non-neighboring block, wherein the neighboring block includes samples adjacent to the current block and the non-neighboring block includes samples not adjacent to the current block. Hereinafter, samples determining the candidate block are defined as basic samples. In addition, basic samples adjacent to the current block are referred to as neighboring basic samples, and basic samples not adjacent to the current block are referred to as non-neighboring basic samples.

[0157] The neighboring basic sample points may be included in the neighboring columns of the leftmost column of the current block or the neighboring rows of the uppermost row of the current block. In an example, when the coordinates of the upper left sample point of the current block are (0,0), at least one of the blocks including the basic sample points at positions (-1,H-1), (W-1,-1), (W,-1), (-1,H) or (-1,1) may be used as a candidate block. Referring to the diagram, neighboring blocks of indexes 0 to 4 may be used as candidate blocks.

[0158] The non-neighboring basic sample points represent samples whose at least one of the x-axis distance or the y-axis distance from the basic sample points adjacent to the current block has a predefined value. In an example, at least one of a block including a basic sample point whose x-axis distance from the left basic sample point is a predefined value, a block including a non-neighboring sample point whose y-axis distance from the upper basic sample point is a predefined value, or a block including a non-neighboring sample point whose x-axis distance and y-axis distance from the upper left basic sample point are predefined values ​​may be used as a candidate block. The predefined value may be a natural number such as 4, 8, 12, 16, etc. Referring to the accompanying drawings, at least one of the blocks of indexes 5 to 26 may be used as a candidate block.

[0159] Sample points that are not located on the same vertical line, horizontal line, or diagonal line as adjacent basic sample points may be set as non-adjacent basic sample points.

[0160] Hereinafter, among the candidate blocks, a candidate block including neighboring basic samples is referred to as a neighboring block, and a block including non-neighboring basic samples is referred to as a non-neighboring block.

[0161] When the distance between the current block and the candidate block is equal to or greater than a threshold, the candidate block may be set to be unavailable as a merge candidate. The threshold may be determined based on the size of the coding tree unit. In an example, the threshold may be set to the height of the coding tree unit (ctu_height) or a value obtained by adding an offset to the height of the coding tree unit or subtracting an offset from the height of the coding tree unit (e.g., ctu_height±N). As a predefined value in the encoder and decoder, the offset N may be set to 4, 8, 16, 32, or ctu_height.

[0162] When a difference between a y-axis coordinate of the current block and a y-axis coordinate of a sample included in the candidate block is greater than a threshold value, the candidate block may be determined to be unusable as a merge candidate.

[0163] Optionally, a candidate block that does not belong to the same coding tree unit as the current block may be set to be unavailable as a merge candidate. In an example, when a base sample is outside the upper boundary of the coding tree unit to which the current block belongs, the candidate block including the base sample may be set to be unavailable as a merge candidate.

[0164] If the upper boundary of the current block is connected to the upper boundary of the coding tree unit, multiple candidate blocks may be determined to be unavailable as merge candidates, thereby reducing the encoding / decoding efficiency of the current block. In order to solve such a problem, the candidate blocks may be set so that the number of candidate blocks at the left position of the current block is greater than the number of candidate blocks at the upper position of the current block.

[0165] Fig. 9 is a diagram illustrating candidate blocks for deriving merge candidates.

[0166] As in Fig. 9 In the example shown in, the upper blocks of the N upper block columns belonging to the current block and the left blocks of the M left block columns belonging to the current block can be set as candidate blocks. In this case, the number of left candidate blocks can be set to be greater than the number of upper candidate blocks by setting M to be greater than N.

[0167] In an example, the difference between the y-axis coordinates of the basic sample points in the current block and the y-axis coordinates of the upper block that can be used as the candidate block can be set to not more than N times the height of the current block. In addition, the difference between the y-axis coordinates of the basic sample points in the current block and the y-axis coordinates of the left block that can be used as the candidate block can be set to not more than M times the width of the current block.

[0168] In the example, Fig. 9In the example shown in , it is shown that blocks belonging to 2 upper block columns of the current block and blocks belonging to 5 left block columns of the current block are set as candidate blocks.

[0169] The merge candidate may be derived from a temporally adjacent block included in a picture different from the current block. In an example, the merge candidate may be derived from a co-located block included in a co-located picture. Any one of the reference pictures included in the reference picture list may be set as the co-located picture. Index information identifying the co-located picture in the reference picture may be signaled in a bitstream. Optionally, a reference picture with a predefined index in the reference picture may be determined as the co-located picture.

[0170] The motion information of the merge candidate may be set to be the same as the motion information of the candidate block. In an example, at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index of the candidate block may be set to the motion information of the merge candidate.

[0171] A merge candidate list including merge candidates may be generated S702.

[0172] The indexes of the merge candidates in the merge candidate list may be assigned according to a predetermined order. In an example, the indexes may be assigned in the order of a merge candidate derived from a left neighboring block, a merge candidate derived from an upper neighboring block, a merge candidate derived from an upper right neighboring block, a merge candidate derived from a lower left neighboring block, a merge candidate derived from an upper left neighboring block, and a merge candidate derived from a temporal neighboring block.

[0173] When multiple merge candidates are included in the merge candidate list, at least one merge candidate among the multiple merge candidates may be selected S703. Specifically, information for specifying any one of the multiple merge candidates may be sent as a bitstream signal. In the example, information merge_idx indicating an index of any one of the merge candidates included in the merge candidate list may be sent as a bitstream signal.

[0174] When the number of merge candidates included in the merge candidate list is less than a threshold value, the motion information candidate included in the motion information table may be added to the merge candidate list as a merge candidate. In this regard, the threshold value may be the maximum number of merge candidates that may be included in the merge candidate list or a value minus an offset from the maximum number of merge candidates. The offset may be a natural number such as 1 or 2.

[0175] The motion information table includes motion information candidates derived from a block encoded / decoded based on inter-frame prediction in a current picture. In an example, motion information of the motion information candidate included in the motion information table may be set to be the same as the motion information of the block encoded / decoded based on inter-frame prediction. In this regard, the motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index.

[0176] The motion information candidates included in the motion information table may also be referred to as inter region merging candidates or prediction region merging candidates.

[0177] The maximum number of motion information candidates that can be included in the motion information table can be predefined in the encoder and the decoder. In an example, the maximum number of motion information candidates that can be included in the motion information table can be 1, 2, 3, 4, 5, 6, 7, 8 or more (e.g., 16).

[0178] Optionally, information indicating a maximum number of motion information candidates that can be included in the motion information table may be signaled in the bitstream. The information may be signaled at a sequence level, a picture level, or a slice level. The information may indicate a maximum number of motion information candidates that can be included in the motion information table. Optionally, the information may indicate a difference between a maximum number of motion information candidates that can be included in the motion information table and a maximum number of merge candidates that can be included in the merge candidate list.

[0179] Alternatively, the maximum number of motion information candidates that can be included in the motion information table may be determined according to a picture size, a slice size, or a coding tree unit size.

[0180] The motion information table may be initialized in units of a picture, a slice, a tile, a brick, a coding tree unit, or a coding tree unit line (row or column). In an example, when a slice is initialized, the motion information table is also initialized, so the motion information table may not include any motion information candidates.

[0181] Optionally, information indicating whether the motion information table is to be initialized may be signaled in the bitstream. The information may be signaled at a slice level, a tile level, a partition level, or a block level. A preconfigured motion information table may be used until the information indicates initialization of the motion information table.

[0182] Alternatively, information about the initial motion information candidate may be signaled in a picture parameter set or a slice header. Although the slice is initialized, the motion information table may include the initial motion information candidate. Therefore, the initial motion information candidate may be used for a block that is the first encoding / decoding target in the slice.

[0183] Optionally, the motion information candidate included in the motion information table of the previous coding tree unit may be set as the initial motion information candidate. In an example, the motion information candidate with the smallest index or the largest index among the motion information candidates included in the motion information table of the previous coding tree unit may be set as the initial motion information candidate.

[0184] The blocks are encoded / decoded in a coding / decoding order, and the blocks encoded / decoded based on the inter prediction may be sequentially set as motion information candidates in the coding / decoding order.

[0185] Fig.10 is a diagram for explaining the updating aspect of the motion information table.

[0186] For the current block, when inter prediction is performed S1001, a motion information candidate may be derived based on the current block S1002. The motion information of the motion information candidate may be set to be the same as the motion information of the current block.

[0187] When the motion information table is empty S1003 , the motion information candidate derived based on the current block may be added to the motion information table S1004 .

[0188] When the motion information table already includes motion information candidates S1003, a redundancy check S1005 for the motion information of the current block (or the motion information candidates derived based on the current block) may be performed. The redundancy check is to determine whether the motion information of the pre-stored motion information candidates in the motion information table is the same as the motion information of the current block. The redundancy check may be performed for all pre-stored motion information candidates in the motion information table. Optionally, the redundancy check may be performed for motion information candidates whose indexes among the pre-stored motion information candidates in the motion information table exceed or are lower than a threshold. Optionally, the redundancy check may be performed for a predefined number of motion information candidates. In an example, two motion information candidates with the smallest index or with the largest index may be determined as targets for the redundancy check.

[0189] When a motion information candidate having the same motion information as the current block is not included, a motion information candidate derived based on the current block may be added to the motion information table S1008. Whether the motion information candidates are the same may be determined based on whether their motion information (e.g., motion vector / reference picture index, etc.) is the same.

[0190] In this regard, when the maximum number of motion information candidates has been stored in the motion information table S1006, the oldest motion information candidate may be deleted S1007, and the motion information candidate derived based on the current block may be added to the motion information table S1008. In this regard, the oldest motion information candidate may be a motion information candidate having a maximum index or a minimum index.

[0191] The motion information candidates may be identified by corresponding indices. When a motion information candidate derived from the current block is added to the motion information table, a minimum index (e.g., 0) may be assigned to the motion information candidate, and the index of the pre-stored motion information candidate may be increased by 1. In this regard, when the maximum number of motion information candidates has been stored in the motion information table, the motion information candidate having the largest index is removed.

[0192] Optionally, when adding a motion information candidate derived from the current block to the motion information table, the maximum index may be assigned to the motion information candidate. In an example, when the number of pre-stored motion information candidates in the motion information table is less than the maximum value, an index having the same value as the number of pre-stored motion information candidates may be assigned to the motion information candidate. Optionally, when the number of pre-stored motion information candidates in the motion information table is equal to the maximum value, an index obtained by subtracting 1 from the maximum value may be assigned to the motion information candidate. Optionally, the motion information candidate having the smallest index is removed, and the indexes of the remaining pre-stored motion information candidates are reduced by 1.

[0193] Fig.11 is a diagram illustrating an updating aspect of a motion information table.

[0194] It is assumed that when a motion information candidate derived from the current block is added to the motion information table, a maximum index is assigned to the motion information candidate. In addition, it is assumed that a maximum number of motion information candidates have been stored in the motion information table.

[0195] When the motion information candidate HmvpCand[n+1] derived from the current block is added to the motion information table HmvpCandList, the motion information candidate HmvpCand[0] having the smallest index among the pre-stored motion information candidates may be deleted, and the indexes of the remaining motion information candidates may be reduced by 1. In addition, the index of the motion information candidate HmvpCand[n+1] derived from the current block may be set to the maximum value (for Fig.11 The example shown in , n).

[0196] When the same motion information candidate as the motion information candidate derived based on the current block is pre-stored S1005 , the motion information candidate derived based on the current block may not be added to the motion information table S1009 .

[0197] Optionally, when adding a motion information candidate derived based on the current block to the motion information table, the pre-stored motion information candidate identical to the motion information candidate may be removed. In this case, the same effect as when the index of the pre-stored motion information candidate is re-updated is produced.

[0198] Fig.12is a diagram showing an example in which indexes of pre-stored motion information candidates are updated.

[0199] When the index of the pre-stored motion information candidate that is the same as the motion information candidate mvCand derived from the current block is hIdx, the pre-stored motion information candidate may be removed, and the index of the motion information candidate with an index greater than hIdx may be reduced by 1. In an example, Fig.12 The example shown in shows that HmvpCand[2] identical to mvCand is deleted in the motion information table HvmpCandList, and the indexes from HmvpCand[3] to HmvpCand[n] are decreased by 1.

[0200] Also, the motion information candidate mvCand derived based on the current block may be added to the end of the motion information table.

[0201] Alternatively, an index assigned to the same pre-stored motion information candidate as the motion information candidate derived based on the current block may be updated. For example, the index of the pre-stored motion information candidate may be changed to a minimum value or a maximum value.

[0202] The motion information of the blocks included in the predetermined area may be set not to be added to the motion information table. In an example, the motion information candidate derived based on the motion information of the blocks included in the merge processing area may not be added to the motion information table. Since the encoding / decoding order for the plurality of blocks included in the merge processing area is not defined, it is not appropriate to use the motion information of any one of the plurality of blocks for inter-frame prediction of another block of the plurality of blocks. Therefore, the motion information candidate derived based on the blocks included in the merge processing area may not be added to the motion information table.

[0203] Optionally, the motion information of a block smaller than a preset size may be set not to be added to the motion information table. In an example, the motion information candidate derived based on the motion information of a coding block with a width or height less than 4 or 8 or the motion information of a coding block of 4×4 size may not be added to the motion information table.

[0204] When motion compensation prediction is performed in units of subblocks, a motion information candidate may be derived based on motion information of a representative subblock among a plurality of subblocks included in the current block. In an example, when a subblock merge candidate is used for the current block, the motion information candidate may be derived based on motion information of a representative subblock among the subblocks.

[0205] The motion vector of the sub-block may be derived in the following order. First, one of the merge candidates included in the merge candidate list of the current block may be selected, and an initial shift vector (shVector) may be derived based on the motion vector of the selected merge candidate. And, a shifted sub-block whose base sample position is (xColSb, yColSb) may be derived by adding the initial shift vector to the position (xSb, ySb) of the base sample (e.g., the upper left sample or the center sample) of each sub-block in the coding block. The following equation 1 shows an equation for deriving a shifted sub-block.

[0206] [Equation 1]

[0207] (xColSb, yColSb) = (xSb+shVector[0]>>4, ySb+ShVector[1]>>4)

[0208] Then, a motion vector of a co-located block corresponding to a center position of a sub-block including (xColSb, yColSb) may be set as a motion vector of a sub-block including (xSb, ySb).

[0209] The representative sub-block may mean a sub-block including an upper left sample point, a center sample point, a lower right sample point, an upper right sample point, or a lower left sample point of the current block.

[0210] Fig.13 is a diagram showing the positions of representative sub-blocks.

[0211] Fig.13 (a) represents an example in which a sub-block at the upper left position of the current block is set as a representative sub-block, and Fig.13 (b) represents an example in which a subblock at the center position of the current block is set as a representative subblock. When motion compensation prediction is performed in units of subblocks, a motion information candidate of the current block may be derived based on a motion vector of a subblock including an upper left sample of the current block or a subblock including a center sample of the current block.

[0212] Based on the inter prediction mode of the current block, it may be determined whether the current block will be used as a motion information candidate. In an example, a block encoded / decoded based on an affine motion model may be set to be unusable as a motion information candidate. Therefore, although the current block is encoded / decoded by inter prediction, when the inter prediction mode of the current block is an affine prediction mode, the motion information table may not be updated based on the current block.

[0213] Alternatively, whether the current block is to be used as a motion information candidate may be determined based on at least one of the following items: a motion vector resolution of the current block, whether a merge offset encoding method is applied, whether combined prediction is applied, or whether triangle partitioning is applied. In an example, for at least one of a case when the motion information resolution of the current block is equal to or greater than 2 integer pixels, a case when combined prediction is applied to the current block, a case when triangle partitioning is applied to the current block, or a case when the merge offset encoding method is applied to the current block, the current block may be set to be unusable as a motion information candidate.

[0214] Alternatively, the motion information candidate may be derived from a subblock vector of at least one of the subblocks included in the block encoded / decoded based on the affine motion model. In an example, the motion information candidate may be derived by using a subblock at an upper left position, a subblock at a center position, or a subblock at an upper right position of the current block. Alternatively, an average value of subblock vectors of a plurality of subblocks may be set as the motion vector of the motion information candidate.

[0215] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, the motion information candidate included in the motion information table may be added to the merge candidate list as a merge candidate. The additional processing is performed in an order reflecting the sorting of the indexes of the motion information candidates in ascending or descending order. In an example, the motion information candidate with the largest index may be added to the merge candidate list of the current block first.

[0216] When a motion information candidate included in the motion information table is added to a merge candidate list, a redundancy check between the motion information candidate and a pre-stored merge candidate in the merge candidate list may be performed. As a result of the redundancy check, a motion information candidate having the same motion information as the pre-stored merge candidate may not be added to the merge candidate list.

[0217] A redundancy check may be performed only for a portion of the motion information candidates included in the motion information table. In an example, a redundancy check may be performed only for motion information candidates whose indexes exceed or are below a threshold. Alternatively, a redundancy check may be performed only for N motion information candidates having a maximum index or a minimum index. Alternatively, a redundancy check may be performed only for a portion of the pre-stored merge candidates in a merge candidate list. In an example, a redundancy check may be performed only for merge candidates whose indexes exceed or are below a threshold or for merge candidates derived from a block at a specific position. In this regard, the specific position may include at least one of a left neighboring block, an upper neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.

[0218] Fig.14 is a diagram showing an example in which a redundancy check is performed only on a part of merging candidates.

[0219] When the motion information candidate HmvpCand[j] is added to the merge candidate list, a redundancy check of 2 merge candidates mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1] having the largest index may be performed for the motion information candidate. In this regard, NumMerge may show the number of available spatial merge candidates and temporal merge candidates.

[0220] Unlike the example shown, when the motion information candidate HmvpCand[j] is added to the merge candidate list, a redundancy check of the two merge candidates with the smallest index may be performed for the motion information candidate. For example, it may be checked whether mergeCandList[0] and mergeCandList[1] are the same as HmvpCand[j].

[0221] Optionally, a redundancy check may be performed only for merge candidates derived from a specific position. In an example, a redundancy check may be performed for at least one of merge candidates derived from a neighboring block located to the left of the current block or above the current block. When there is no merge candidate derived from a specific position in the merge candidate list, the motion information candidate may be added to the merge candidate list without performing a redundancy check.

[0222] When the motion information candidate HmvpCand[j] is added to the merge candidate list, a redundancy check of 2 merge candidates mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1] having the largest index may be performed for the motion information candidate. In this regard, NumMerge may show the number of available spatial merge candidates and temporal merge candidates.

[0223] Redundancy check on merge candidates may be performed only for a portion of motion information candidates among motion information candidates. In an example, redundancy check may be performed only for N motion information candidates with large indexes or small indexes among motion information candidates included in a motion information table. In an example, redundancy check may be performed only for motion information candidates with indexes whose sum difference of numbers of motion information candidates included in the motion information table is lower than a threshold. When the threshold is 2, redundancy check may be performed only for 3 motion information candidates with the largest index value among motion information candidates included in the motion information table. Redundancy check may be omitted for motion information candidates other than the above 3 motion information candidates. When redundancy check is omitted, the motion information candidate may be added to the merge candidate list regardless of whether there is the same motion information as the merge candidate.

[0224] In contrast, the redundancy check is set to be performed only for the motion information candidates having the index whose sum of the numbers of the motion information candidates included in the motion information table exceeds the threshold value.

[0225] The number of motion information candidates for performing redundancy check may be redefined in the encoder and the decoder. In an example, the threshold may be an integer such as 0, 1 or 2.

[0226] Alternatively, the threshold may be determined based on at least one of the number of merge candidates included in the merge candidate list or the number of motion information candidates included in the motion information table.

[0227] When a merge candidate identical to the first motion information candidate is found, redundant checking of the merge candidate identical to the first motion information candidate may be omitted in redundant checking for the second motion information candidate.

[0228] Fig.15 is a diagram illustrating an example of omitting a redundant check on a specific merge candidate.

[0229] When a motion information candidate HmvpCand[i] with an index of i is added to a merge candidate list, a redundancy check is performed between the motion information candidate and a pre-stored merge candidate in the merge candidate list. In this regard, when a merge candidate mergeCandlist[j] identical to the motion information candidate HmvpCand[i] is found, a redundancy check may be performed between the motion information candidate HmvpCand[i-1] with an index of i-1 and the merge candidate without adding the motion information candidate HmvpCand[i] to the merge candidate list. In this regard, a redundancy check may be omitted between the motion information candidate HmvpCand[i-1] and the merge candidate mergeCandList[j].

[0230] In the example, Fig.15 In the example shown in , it is determined that HmvpCand[i] and mergeCandList[2] are the same. Therefore, a redundancy check for HmvpCand[i-1] may be performed without adding HmvpCand[i] to the merge candidate list. In this regard, a redundancy check between HmvpCand[i-1] and mergeCandList[2] may be omitted.

[0231] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, at least one of a paired merge candidate or a zero merge candidate may be further included in addition to the motion information candidate. The paired merge candidate indicates a merge candidate having a value obtained by averaging motion vectors of more than 2 merge candidates as a motion vector, and the zero merge candidate indicates a merge candidate having a motion vector of 0.

[0232] For the merge candidate list of the current block, merge candidates may be added in the following order.

[0233] Spatial merging candidate - Temporal merging candidate - Motion information candidate - (affine motion information candidate) - Paired merging candidate - Zero merging candidate

[0234] The spatial merge candidate indicates a merge candidate derived from at least one of a neighboring block or a non-neighboring block, and the temporal merge candidate indicates a merge candidate derived from a previous reference picture. The affine motion information candidate indicates a motion information candidate derived from a block encoded / decoded by an affine motion model.

[0235] The motion information table may also be used in the motion vector prediction mode. In an example, when the number of motion vector prediction candidates included in the motion vector prediction candidate list of the current block is less than a threshold value, the motion information candidate included in the motion information table may be set as a motion vector prediction candidate for the current block. Specifically, the motion vector of the motion information candidate may be set as a motion vector prediction candidate.

[0236] If any one of the motion vector prediction candidates included in the motion vector prediction candidate list of the current block is selected, the selected candidate may be set as a motion vector predictor of the current block. Then, after decoding the motion vector residual value of the current block, the motion vector of the current block may be obtained by adding the motion vector predictor and the motion vector residual value.

[0237] The motion vector prediction candidate list of the current block may be configured in the following order.

[0238] Spatial motion vector prediction candidate - Temporal motion vector prediction candidate - Motion information candidate - (affine motion information candidate) - Zero motion vector prediction candidate

[0239] The spatial motion vector prediction candidate represents a motion vector prediction candidate derived from at least one of a neighboring block or a non-neighboring block, and the temporal motion vector prediction candidate represents a motion vector prediction candidate derived from a previous reference picture. The affine motion information candidate represents a motion information candidate derived from a block encoded / decoded by an affine motion model. The zero motion vector prediction candidate represents a candidate whose motion vector value is 0.

[0240] A merge processing area larger than a coding block may be defined. The coding blocks included in the merge processing area may be processed in parallel without being encoded / decoded sequentially. In this regard, not being encoded / decoded sequentially means that the order of encoding / decoding is not defined. Therefore, the encoding / decoding processing of the blocks included in the merge processing area may be processed independently. Optionally, the blocks included in the merge processing area may share merge candidates. In this regard, merge candidates may be derived based on the merge processing area.

[0241] According to the above features, the merged processing region may be referred to as a parallel processing region, a shared merge region (SMR), or a merged estimation region (MER).

[0242] A merge candidate of the current block may be derived based on the coding block. However, when the current block is included in a merge processing region larger than the current block, a candidate block included in the same merge processing region as the current block may be set to be unavailable as a merge candidate.

[0243] Fig.16 is a diagram illustrating an example in which a candidate block included in the same merge processing region as a current block is set to be unusable as a merge candidate.

[0244] exist Fig.16 In the example shown in (a), in encoding / decoding of CU5, blocks including basic samples adjacent to CU5 may be set as candidate blocks. In this regard, candidate blocks x3 and x4 included in the same merge processing region as CU5 may be set as unusable as merge candidates for CU5. However, candidate blocks x0, x1, and x2 not included in the same merge processing region as CU5 may be set as usable as merge candidates.

[0245] exist Fig.16 In the example shown in (b), in encoding / decoding of CU8, blocks including basic samples adjacent to CU8 may be set as candidate blocks. In this regard, candidate blocks x6, x7, and x8 included in the same merge processing region as CU8 may be set to be unavailable as merge candidates. However, candidate blocks x5 and x9 not included in the same merge processing region as CU8 may be set to be available as merge candidates.

[0246] Alternatively, when the current block is included in the merge processing region, neighboring blocks adjacent to the current block and the merge processing region may be set as candidate blocks.

[0247] Fig.17 is a diagram illustrating an example of deriving a merge candidate for a current block when the current block is included in a merge processing region.

[0248] As in Fig.17In the example shown in (a), a neighboring block adjacent to the current block may be set as a candidate block for deriving a merge candidate for the current block. In this regard, a candidate block included in the same merge processing region as the current block may be set to be unusable as a merge candidate. In the example, when deriving a merge candidate for the coding block CU3, the upper neighboring block y3 and the upper right neighboring block y4 included in the same merge processing region as the coding block CU3 may be set to be unusable as a merge candidate for the coding block CU3.

[0249] By scanning neighboring blocks adjacent to the current block in a predefined order, a merge candidate may be derived. In an example, the predefined order may be the order of y1, y3, y4, y0, and y2.

[0250] When the number of merge candidates that can be derived from neighboring blocks adjacent to the current block is less than the value of the maximum number of merge candidates minus the offset or the maximum number, the Fig.17 The example shown in (b) derives a merge candidate for the current block by using a neighboring block adjacent to the merge processing region. In the example, a neighboring block adjacent to the merge processing region including the coding block CU3 may be set as a candidate block for the coding block CU3. In this regard, the neighboring block adjacent to the merge processing region may include at least one of a left neighboring block x1, an upper neighboring block x3, a lower left neighboring block x0, an upper right neighboring block x4, or an upper left neighboring block x2.

[0251] By scanning neighboring blocks adjacent to the merge processing area in a predefined order, a merge candidate can be derived. In an example, the predefined order can be the order of x1, x3, x4, x0 and x2.

[0252] In summary, a merge candidate for the coding block CU3 included in the merge processing area can be derived by scanning the candidate blocks in the following scanning order.

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

[0254] However, the scanning order of the candidate blocks shown above only shows an example of the present disclosure, and the candidate blocks may be scanned in an order different from the above example. Optionally, the scanning order may be adaptively determined based on at least one of the size or shape of the current block or the merge processing area.

[0255] The merged processing area may be square or non-square. Information for determining the merged processing area may be sent as a bitstream signal. The information may include at least one of information indicating the shape of the merged processing area or information indicating the size of the merged processing area. When the merged processing area is non-square, at least one of information indicating the size of the merged processing area, information indicating the width or height of the merged processing area, or information indicating the aspect ratio of the merged processing area may be sent as a bitstream signal.

[0256] The size of the merge processing area may be determined based on at least one of information signaled in a bitstream, a picture resolution, a size of a slice, or a size of a tile.

[0257] If motion compensation prediction is performed on a block included in the merge processing region, motion information candidates derived based on motion information of the block on which motion compensation prediction is performed may be added to the motion information table.

[0258] However, if the motion information candidate derived from the block included in the merge processing area is added to the motion information table, a situation may occur where the motion information candidate derived from the block is used in encoding / decoding of other blocks in the merge processing area whose encoding / decoding is actually slower than that of the block. In other words, although the dependency between blocks should be excluded in encoding / decoding of the block included in the merge processing area, a situation may occur where motion prediction compensation is performed by using motion information of other blocks included in the merge processing area. In order to solve such a problem, although encoding / decoding of the block included in the merge processing area is completed, the motion information of the block for which encoding / decoding is completed may not be added to the motion information table.

[0259] Alternatively, the motion information table may be updated using only blocks at predefined positions within the merge processing area. Examples of the predefined position may include at least one of a block located at the upper left of the merge processing area, a block located at the upper right of the merge processing area, a block located at the lower left of the merge processing area, a block located at the lower right of the merge processing area, a block located at the center of the merge processing area, a block adjacent to the right border of the merge processing area, and a block adjacent to the lower border of the merge processing area. As an example, the motion information table may be updated using only the motion information of a block adjacent to the lower right corner of the merge processing area, and the motion information of other blocks may not be used to update the motion information table.

[0260] Alternatively, after decoding of all blocks included in the merge processing area is completed, motion information candidates derived from the blocks may be added to the motion information table. That is, although the blocks included in the merge processing area are encoded / decoded, the motion information table may not be updated.

[0261] In an example, if motion compensation prediction is performed for a block included in a merge processing area, motion information candidates derived from the block may be added to a motion information table in a predefined order. In this regard, the predefined order may be determined according to a scanning order of coding blocks in a merge processing area or a coding tree unit. The scanning order may be at least one of a raster scan, a horizontal scan, a vertical scan, or a zigzag scan. Alternatively, the predefined order may be determined based on the motion information of each block or the number of blocks having the same motion information.

[0262] Alternatively, a motion information candidate including unidirectional motion information may be added to the motion information table before a motion information candidate including bidirectional motion information. Conversely, a motion information candidate including bidirectional motion information may be added to the motion information table before a motion information candidate including unidirectional motion information.

[0263] Alternatively, the motion information candidates may be added to the motion information table in order of high usage frequency or low usage frequency in the merge processing region or the coding tree unit.

[0264] When the current block is included in the merge processing region and the number of merge candidates included in the merge candidate list of the current block is less than the maximum number, the motion information candidate included in the motion information table may be added to the merge candidate list. In this regard, the motion information candidate derived from the block included in the same merge processing region as the current block may be set not to be added to the merge candidate list of the current block.

[0265] Optionally, when the current block is included in the merge processing region, it may be set not to use the motion information candidates included in the motion information table. In other words, although the number of merge candidates included in the merge candidate list of the current block is less than the maximum number, the motion information candidates included in the motion information table may not be added to the merge candidate list.

[0266] In another example, a motion information table for a merge processing region or a coding tree unit may be configured. This motion information table plays a role of temporarily storing motion information of blocks included in the merge processing region. In order to distinguish a general motion information table from a motion information table for a merge processing region or a coding tree unit, the motion information table for the merge processing region or the coding tree unit is referred to as a temporary motion information table. Furthermore, the motion information candidates stored in the temporary motion information table are referred to as temporary motion information candidates.

[0267] Fig.18 is a diagram showing a temporary motion information table.

[0268] A temporary motion information table for a coding tree unit or a merge processing area may be configured. When motion compensation prediction is performed on a current block included in a coding tree unit or a merge processing area, the motion information of the block may not be added to the motion information table HmvpCandList. Alternatively, a temporary motion information candidate derived from the block may be added to the temporary motion information table HmvpMERCandList. In other words, the temporary motion information candidate added to the temporary motion information table may not be added to the motion information table. Therefore, the motion information table may not include a motion information candidate derived based on the motion information of a block included in the coding tree unit or the merge processing area including the current block.

[0269] Optionally, only the motion information of some blocks included in the merge processing area may be added to the temporary motion information table. As an example, only the blocks at predefined positions within the merge processing area may be used to update the motion information table. The predefined position may include at least one of a block located at the upper left of the merge processing area, a block located at the upper right of the merge processing area, a block located at the lower left of the merge processing area, a block located at the lower right of the merge processing area, a block located at the center of the merge processing area, a block adjacent to the right border of the merge processing area, and a block adjacent to the lower border of the merge processing area. As an example, only the motion information of the block adjacent to the lower right corner of the merge processing area may be added to the temporary motion information table, and the motion information of other blocks may not be added to the temporary motion information table.

[0270] The maximum number of temporary motion information candidates that the temporary motion information table can include may be set to be equal to the maximum number of motion information candidates that the motion information table can include. Alternatively, the maximum number of temporary motion information candidates that the temporary motion information table can include may be determined according to the size of the coding tree unit or the merge processing region. Alternatively, the maximum number of temporary motion information candidates that the temporary motion information table can include may be set to be less than the maximum number of motion information candidates that the motion information table can include.

[0271] The current block included in the coding tree unit or the merge processing area may be set not to use the temporary motion information table about the corresponding coding tree unit or the merge processing area. In other words, when the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, the motion information candidates included in the motion information table may be added to the merge candidate list, and the temporary motion information candidates included in the temporary motion information table may not be added to the merge candidate list. Therefore, the motion information of other blocks included in the same coding tree unit or the same merge processing area as the current block may not be used for motion compensation prediction of the current block.

[0272] If encoding / decoding of all blocks included in the coding tree unit or the merge processing area is completed, the motion information table and the temporary motion information table may be made consistent.

[0273] Fig.19 is a diagram showing an example of making the motion information table and the temporary motion information table consistent.

[0274] If encoding / decoding of all blocks included in the coding tree unit or the merge processing area is completed, as in Fig.19 In the example shown in , the temporary motion information candidates included in the temporary motion information table may be updated in the motion information table.

[0275] In this regard, the temporary motion information candidates included in the temporary motion information table may be added to the motion information table in the order of insertion in the temporary motion information table (in other words, in ascending or descending order of index values).

[0276] In another example, the temporary motion information candidates included in the temporary motion information table may be added to the motion information table in a predefined order. In this regard, the predefined order may be determined according to a scanning order of coding blocks in a merge processing area or a coding tree unit. The scanning order may be at least one of a raster scan, a horizontal scan, a vertical scan, or a zigzag scan. Alternatively, the predefined order may be determined based on the motion information of each block or the number of blocks having the same motion information.

[0277] Alternatively, a temporary motion information candidate including unidirectional motion information may be added to the motion information table before a temporary motion information candidate including bidirectional motion information. Conversely, a temporary motion information candidate including bidirectional motion information may be added to the motion information table before a temporary motion information candidate including unidirectional motion information.

[0278] Alternatively, the temporary motion information candidates may be added to the motion information table in the order of high usage frequency or low usage frequency in the merge processing region or the coding tree unit.

[0279] In the case where a temporary motion information candidate included in the temporary motion information table is added to the motion information table, a redundancy check for the temporary motion information candidate may be performed. In an example, when a motion information candidate identical to the temporary motion information candidate included in the temporary motion information table is pre-stored in the motion information table, the temporary motion information candidate may not be added to the motion information table. In this regard, a redundancy check may be performed for a portion of the motion information candidates included in the motion information table. In an example, a redundancy check may be performed for motion information candidates having an index exceeding or below a threshold. In an example, when the temporary motion information candidate is equal to a motion information candidate having an index higher than a predefined value, the temporary motion information candidate may not be added to the motion information table.

[0280] This may limit the use of motion information candidates derived from blocks included in the same coding tree unit or the same merge processing region as the current block as the merge candidate of the current block. To this end, address information of the block may be additionally stored for the motion information candidate. The address information of the block may include at least one of the position of the block, the address of the block, the index of the block, the position of the merge processing region including the block, the address of the merge processing region including the block, the index of the merge processing region including the block, the position of the coding tree region including the block, the address of the coding tree region including the block, or the index of the coding tree region including the block.

[0281] Intra-frame prediction predicts a current block by using reconstructed samples that have been encoded / decoded and are around the current block. In this regard, the reconstructed samples before applying the in-loop filter may be used for intra-frame prediction of the current block.

[0282] The intra prediction method includes matrix-based intra prediction and direction-based intra prediction using adjacent reconstruction samples. Information indicating the intra prediction method of the current block can be sent as a bitstream signal. The information can be a 1-bit flag. Optionally, the intra prediction of the current block can be determined based on at least one of the position of the current block, the size of the current block, the shape of the current block, or the intra prediction method of the adjacent block. In the example, when the current block crosses the picture boundary, it can be set so that the matrix-based intra prediction method is not applied to the current block.

[0283] The matrix-based intra prediction method is a method for obtaining a prediction block of a current block based on the matrix product of the matrix stored in the encoder and the decoder and the reconstructed samples around the current block. Information for specifying any one of a plurality of pre-stored matrices may be signaled in a bitstream. The decoder may determine the matrix for performing intra prediction on the current block based on the above information and the size of the current block.

[0284] General intra prediction is a method of obtaining a prediction block of a current block based on a non-directional intra prediction mode or a directional intra prediction mode. Hereinafter, a process of intra prediction based on general intra prediction will be described in detail with reference to the accompanying drawings.

[0285] Fig. 20 is a flowchart of an intra-frame prediction method according to an embodiment of the present disclosure.

[0286] A reference sample line of the current block may be determined S2001. The reference sample line refers to a set of reference samples included in the kth line spaced above and / or to the left of the current block. The reference samples may be derived from reconstructed samples encoded / decoded around the current block.

[0287] Index information identifying a reference sample line for a current block among a plurality of reference sample lines may be signaled in a bitstream. In an example, index information intra_luma_ref_idx for specifying a reference sample line of the current block may be signaled in a bitstream. The index information may be signaled per coding block.

[0288] The plurality of reference sample lines may include at least one of a first line, a second line, or a third line above and / or at the left side of the current block. A reference sample line including a row adjacent to the top of the current block and a column adjacent to the left side of the current block among the plurality of reference sample lines may be referred to as an adjacent reference sample line, and the other reference sample lines may be referred to as a non-adjacent reference sample line.

[0289] Table 1 shows the index assigned to each candidate reference sample line.

[0290]

Table 1

[0291]

[0292]

[0293] Based on at least one of the position, size, shape, or prediction coding mode of the current block, the reference sample line of the current block may be determined. In one example, when the current block is adjacent to a boundary of a picture, a tile, a slice, or a coding tree unit, the adjacent reference sample line may be determined as the reference sample line of the current block. The reference sample line may include an upper reference sample located above the current block and a left reference sample located on the left side of the current block. The upper reference sample and the left reference sample may be derived from the reconstructed samples around the current block. The reconstructed samples may be in a state before the in-loop filter is applied.

[0294] Next, the intra prediction mode of the current block may be determined S2002. For the intra prediction mode of the current block, at least one of a non-directional intra prediction mode or a directional intra prediction mode may be determined as the intra prediction mode of the current block. The non-directional intra prediction mode includes plane and DC, and the directional intra prediction mode includes 33 or 65 modes from the lower left diagonal direction to the upper right diagonal direction.

[0295] Fig.21 is a diagram showing an intra prediction mode.

[0296] Fig.21 (a) shows 35 intra prediction modes. Fig.21 (b) shows 67 intra prediction modes.

[0297] Definable ratio Fig.21 The number of intra prediction modes shown in FIG. 1 may be a greater or lesser number of intra prediction modes.

[0298] Based on the intra prediction mode of the neighboring blocks adjacent to the current block, the MPM (Most Probable Mode) may be set. In this regard, the neighboring blocks may include a left neighboring block adjacent to the left side of the current block and an upper neighboring block adjacent to the upper side of the current block.

[0299] The number of MPMs included in the MPM list may be preset in the encoder and the decoder. In an example, the number of MPMs may be 3, 4, 5, or 6. Optionally, information indicating the number of MPMs may be signaled in a bitstream. Optionally, the number of MPMs may be determined based on at least one of the prediction coding mode of the neighboring block, the size, shape, or reference sample line index of the current block. In an example, N MPMs may be used when an adjacent reference sample line is determined as a reference sample line of the current block, and M MPMs may be used when a non-adjacent reference sample line is determined as a reference sample line of the current block. When M is a natural number less than N, in an example, N may be 6 and M may be 5, 4, or 3. Therefore, when the index of the reference sample line of the current block is 0 and the MPM flag is true, the intra-frame prediction mode of the current block may be determined as any one of the 6 candidate intra-frame prediction modes, and when the index of the reference sample line of the current block is greater than 0 and the MPM flag is true, the intra-frame prediction mode of the current block may be determined as any one of the 5 candidate intra-frame prediction modes.

[0300] Alternatively, a fixed number (eg, 6 or 5) of MPM candidates may be used regardless of the index of the reference sample line of the current block.

[0301] When matrix-based intra prediction is applied to neighboring blocks, MPM candidates may be derived by inferring the intra prediction modes of the neighboring blocks as planes.

[0302] When intra BDPCM is applied to a neighboring block, an MPM candidate may be derived by inferring the intra prediction mode of the neighboring block as a default mode. In this case, the default mode may be at least one of DC, planar, vertical direction, or horizontal direction.

[0303] Optionally, based on the intra BDPCM application direction of the neighboring block, the intra prediction mode of the neighboring block may be determined. In an example, when the intra BDPCM in the horizontal direction is applied to the neighboring block, the intra prediction mode of the neighboring block may be inferred to be in the horizontal direction. On the other hand, when the intra BDPCM in the vertical direction is applied to the neighboring block, the intra prediction mode of the neighboring block may be inferred to be in the vertical direction.

[0304] An MPM list including a plurality of MPMs may be generated, and information indicating whether the MPM identical to the intra prediction mode of the current block is included in the MPM list may be signaled in a bitstream. When the information is a 1-bit flag, it may be referred to as an MPM flag. When the MPM flag indicates that the MPM identical to the current block is included in the MPM list, index information identifying one of the MPMs may be signaled in a bitstream. In an example, index information mpm_idx specifying any one of the plurality of MPMs may be signaled in a bitstream. The MPM specified by the index information may be set to the intra prediction mode of the current block. When the MPM flag indicates that the MPM identical to the current block is not included in the MPM list, the remaining mode information indicating any one of the remaining intra prediction modes other than the MPM may be signaled in a bitstream. The remaining mode information indicates an index value corresponding to the intra prediction mode of the current block when reassigning indexes to the remaining intra prediction modes other than the MPM. The decoder may determine the intra prediction mode of the current block by arranging the MPMs in ascending order and comparing the remaining mode information with the MPM. In an example, when the remaining mode information is equal to or less than the MPM, the intra prediction mode of the current block may be derived by adding 1 to the remaining mode information.

[0305] When deriving the intra-frame prediction mode of the current block, the operation of comparing a part of the MPM with the remaining mode information may be omitted. In the example, the MPM in the non-directional intra-frame prediction mode in the MPM may be excluded from the comparison target. When the non-directional intra-frame prediction mode is set to the MPM, the remaining mode information obviously indicates the directional intra-frame prediction mode, so the intra-frame prediction mode of the current block may be derived by comparing the remaining MPMs except the non-directional intra-frame prediction mode with the remaining mode information. As an alternative to excluding the non-directional intra-frame prediction mode from the comparison target, after adding the number of non-directional intra-frame prediction modes to the remaining mode information, the resulting value may be compared with the remaining MPMs.

[0306] As an alternative to setting the default mode to MPM, information indicating whether the intra-frame prediction mode of the current block is the default mode may be signaled in the bitstream. The information is a 1-bit flag, and the flag may be referred to as a default mode flag. The default mode flag may be signaled only when the MPM flag indicates that the same MPM as the current block is included in the MPM list. As described above, the default mode may include at least one of a plane, a DC, a vertical direction mode, or a horizontal direction mode. In the example, when the plane is set to the default mode, the default mode flag may indicate whether the intra-frame prediction mode of the current block is a plane. When the default mode flag indicates that the intra-frame prediction mode of the current block is not the default mode, one of the MPMs indicated by the index information may be set as the intra-frame prediction mode of the current block.

[0307] When the default mode flag is used, the intra prediction mode that is the same as the default mode may be set to not be set to MPM. In the example, when the default mode flag indicates whether the intra prediction mode of the current block is plane, the intra prediction mode of the current block may be derived by using 5 MPMs other than the MPM corresponding to the plane.

[0308] When a plurality of intra prediction modes are set as default modes, index information indicating any one of the default modes may also be signaled. The intra prediction mode of the current block may be set to the default mode indicated by the index information.

[0309] When the index of the reference sample line of the current block is not 0, it may be set not to use the default mode. In an example, when a non-adjacent reference sample line is determined as a reference sample line of the current block, it may be set not to use a non-directional intra prediction mode such as a DC mode or a planar mode. Therefore, when the index of the reference sample line is not 0, the default mode flag may not be signaled, and the value of the default mode flag may be inferred to be a predefined value (ie, false).

[0310] When the intra prediction mode of the current block is determined, prediction samples for the current block may be obtained based on the determined intra prediction mode S2003.

[0311] When the DC mode is selected, the prediction sample for the current block may be generated based on the average value of the reference samples. In detail, the values ​​of all samples in the prediction block may be generated based on the average value of the reference samples. The average value may be derived using at least one of an upper reference sample adjacent to the upper side of the current block and a left reference sample adjacent to the left side of the current block.

[0312] The number or range of reference samples used when deriving the average value may vary based on the shape of the current block. In an example, when the current block is a non-square block having a width greater than a height, the average value may be calculated by using an upper reference sample. Conversely, when the current block is a non-square block having a width less than a height, the average value may be calculated by using a left reference sample. In other words, when the width and height of the current block are different, the average value may be calculated using a reference sample adjacent to a larger length. Alternatively, whether to calculate the average value by using an upper reference sample or a left reference sample may be determined based on the aspect ratio of the current block.

[0313] When the planar mode is selected, the prediction sample may be obtained by using the horizontal prediction sample and the vertical prediction sample. In this regard, the horizontal prediction sample may be obtained based on the left reference sample and the right reference sample located on the same horizontal line as the prediction sample, and the vertical prediction sample may be obtained based on the upper reference sample and the lower reference sample located on the same vertical line as the prediction sample. In this regard, the right reference sample may be generated by copying the reference sample adjacent to the upper right corner of the current block, and the lower reference sample may be generated by copying the reference sample adjacent to the lower left corner of the current block. The horizontal prediction sample may be obtained based on the weighted sum of the left reference sample and the right reference sample, and the vertical prediction sample may be obtained based on the weighted sum of the upper reference sample and the lower reference sample. In this regard, the weighting factor assigned to each reference sample may be determined according to the position of the prediction sample. The prediction sample may be obtained based on the average or weighted sum of the horizontal prediction sample and the vertical prediction sample. When the weighted sum is used, the weighting factors assigned to the horizontal direction prediction samples and the vertical direction prediction samples may be determined based on the positions of the prediction samples.

[0314] When a directional prediction mode is selected, a parameter representing a prediction direction (or a prediction angle) of the selected directional prediction mode may be determined. Table 2 below represents an intra directional parameter intraPredAng for each intra prediction mode.

[0315]

Table 2

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

[0317] Table 2 represents the intra-frame direction parameter of each intra-frame prediction mode, wherein, when 35 intra-frame prediction modes are defined, the index of each intra-frame prediction mode is one of 2 to 34. When the directional intra-frame prediction mode is defined as more than 33, the intra-frame direction parameter of each intra-frame prediction mode can be set by subdividing Table 2. The upper reference sample and the left reference sample for the current block are arranged in a line, and then the prediction sample can be obtained based on the value of the intra-frame direction parameter. In this regard, when the value of the intra-frame direction parameter is a negative value, the left reference sample and the upper reference sample can be arranged in a line.

[0318] Fig. 22 and Fig.23 are diagrams each showing an example of a one-dimensional arrangement in which reference samples are arranged in a line.

[0319] Fig. 22 is a diagram showing a one-dimensional arrangement in the vertical direction in which reference samples are arranged in the vertical direction, and Fig.23 35 intra prediction modes are defined. Fig. 22 and Fig.23.

[0320] When the intra prediction mode index is any one of 11 to 18, a one-dimensional arrangement in the horizontal direction may be applied, wherein the upper reference sample is rotated counterclockwise, and when the intra prediction mode index is any one of 19 to 25, a one-dimensional arrangement in the vertical direction may be applied, wherein the left reference sample is rotated clockwise. When arranging the reference samples in a line, the intra prediction mode angle may be considered.

[0321] The reference sample determination parameters may be determined based on the intra direction parameters. The reference sample determination parameters may include a reference sample index for specifying a sample and a weighting factor parameter for determining a weighting factor applied to the reference sample.

[0322] The reference sample index iIdx and the weighting factor parameter ifact may be obtained by the following Equation 2 and Equation 3, respectively.

[0323] [Equation 2]

[0324] iIdx=(y+1)*P ang / 32

[0325] [Equation 3]

[0326] i fact =[(y+1)*P ang ]&31

[0327] In Equation 2 and Equation 3, P ang Indicates intra-frame direction parameters. The reference sample specified by the reference sample index iIdx corresponds to an integer pixel.

[0328] In order to derive the prediction sample, at least one reference sample may be specified. In detail, according to the slope of the prediction mode, the position of the reference sample used to derive the prediction sample may be specified. In an example, the reference sample used to derive the prediction sample may be specified by using the reference sample index iIdx.

[0329] In this regard, when the slope of the intra prediction mode is not represented by one reference sample, the prediction sample may be generated by interpolating a plurality of reference samples. In an example, when the slope of the intra prediction mode is a value between a slope between the prediction sample and a first reference sample and a slope between the prediction sample and a second reference sample, the prediction sample may be obtained by interpolating the first reference sample and the second reference sample. In other words, when an angle line according to an intra prediction angle does not pass through a reference sample located at an integer pixel, the prediction sample may be obtained by interpolating reference samples adjacent to the left and right sides or above and below the position where the angle line passes.

[0330] Equation 4 below represents an example of obtaining a prediction sample based on a reference sample.

[0331] [Equation 4]

[0332] P(x,y)=((32-i fact ) / 32)*Ref_1D(x+iIdx+1)+(i fact / 32)*Ref_1D(x+iIdx+2)

[0333] In Equation 4, P represents a prediction sample, and Ref_1D represents any one of the reference samples arranged in a line. In this regard, the position of the reference sample may be determined by the position (x, y) of the prediction sample and the reference sample index iIdx.

[0334] When the slope of the intra prediction mode may be represented by a reference sample, the weighting factor parameter i fact is set to 0. Therefore, Equation 4 can be simplified to the following Equation 5.

[0335] [Equation 5]

[0336] P(x, y) = Ref_1D(x+iIdx+1)

[0337] Intra prediction for the current block may be performed based on a plurality of intra prediction modes. In an example, an intra prediction mode may be derived for each prediction sample, and a prediction sample may be derived based on the intra prediction mode assigned to each prediction sample.

[0338] Optionally, an intra prediction mode may be derived for each region, and intra prediction for each region may be performed based on the intra prediction mode assigned to each region. In this regard, the region may include at least one sample. At least one of the size and shape of the region may be adaptively determined based on at least one of the size of the current block, the shape of the current block, and the intra prediction mode of the current block. Optionally, at least one of the size and shape of the region may be predefined in the encoder and the decoder independently of the size or shape of the current block.

[0339] Fig.24 is a diagram showing the degree formed between a directional intra prediction mode and a straight line parallel to the x-axis.

[0340] As Fig.24 In the example shown in , the directional prediction mode may exist between the lower left diagonal direction and the upper right diagonal direction. When describing the degree formed between the x-axis and the directional prediction mode, the directional prediction mode may exist from 45 degrees (lower left diagonal direction) to -135 degrees (upper right diagonal direction).

[0341] When the current block is non-square, there may be a case where prediction samples are derived by using reference samples located at an angle line according to an intra prediction angle that are located farther than reference samples close to prediction samples according to an intra prediction mode for the current block.

[0342] Fig.25 is a diagram showing an aspect of obtaining prediction samples when the current block is non-square.

[0343] In the example, as Fig. 27 In the example shown in (a), it is assumed that the current block is a non-square with a width greater than a height, and the intra prediction mode for the current block is a directional intra prediction mode with an angle from 0 to 45 degrees. In the above case, when the prediction sample A around the right column of the current block is derived from the reference samples positioned in the angular mode according to the above degrees, there may be a case where the left reference sample L far from the prediction sample is used instead of the upper reference sample T close to the prediction sample.

[0344] In another example, as Fig.25 In the example shown in (b), it is assumed that the current block is a non-square whose height is greater than its width, and the intra prediction mode for the current block is a directional intra prediction mode from -90 degrees to -135 degrees. In the above case, when the prediction sample A around the lower row of the current block is derived from the reference samples positioned in the angular mode according to the above degrees, there may be a case where the upper reference sample T far from the prediction sample is used instead of the left reference sample L close to the prediction sample.

[0345] To solve the above problem, when the current block is non-square, the intra prediction mode for the current block can be replaced by an intra prediction mode in the opposite direction. Fig.21 The directional prediction mode of the angle of the directional prediction mode shown in . The above-mentioned directional intra prediction mode can be defined as a wide-angle intra prediction mode. The wide-angle intra prediction mode indicates a directional intra prediction mode that does not belong to the range of 45 degrees to -135 degrees.

[0346] Fig.26 is a diagram illustrating a wide-angle intra prediction mode.

[0347] exist Fig.26 In the example shown in , the intra prediction modes with indices from -1 to -14 and the intra prediction modes with indices from 67 to 80 represent the wide-angle intra prediction modes.

[0348] exist Fig.26, 14 wide-angle intra prediction modes (from -1 to -14) with angles greater than 45 degrees and 14 wide-angle intra prediction modes (from 67 to 80) with angles less than -135 degrees are shown. However, a greater or lesser number of wide-angle intra prediction modes may be defined.

[0349] When the wide-angle intra prediction mode is used, the length of the upper reference sample may be set to 2W+1, and the length of the left reference sample may be set to 2H+1.

[0350] By using the wide-angle intra prediction mode, the reference sample T can be used to predict Fig.25 (a) and can be predicted by using the reference point L Fig.25 Sample point A shown in (b).

[0351] Together with the conventional intra prediction mode and the N wide-angle intra prediction modes, a total of 67+N intra prediction modes may be used. In an example, Table 3 represents intra direction parameters for intra prediction modes when 20 wide-angle intra prediction modes are defined.

[0352]

Table 3

[0353]

[0354]

[0355] When the current block is non-square and the intra prediction mode for the current block obtained in S2502 belongs to the transformation range, the intra prediction mode for the current block may be transformed into a wide-angle intra prediction mode. The transformation range may be determined based on at least one of the size, shape, or ratio of the current block. In this regard, the ratio may represent the aspect ratio of the current block. When the current block is non-square with a width greater than a height, the transformation range may be set to an intra prediction mode index from the upper right diagonal direction (e.g., 66) to (intra prediction mode index in the upper right diagonal direction - N). In this regard, N may be determined based on the ratio of the current block. When the intra prediction mode for the current block belongs to the transformation range, the intra prediction mode may be transformed into a wide-angle intra prediction mode. The transformation may be to subtract a predefined value from the intra prediction mode, and the predefined value may be the total number of intra prediction modes excluding the wide-angle intra prediction mode (e.g., 67).

[0356] In the above example, the intra prediction modes from number 66 to number 53 may be transformed into wide-angle intra prediction modes from number -1 to number -14, respectively.

[0357] When the current block is a non-square with a height greater than a width, the transformation range may be set to be from the intra prediction mode index in the lower left diagonal direction (e.g., 2) to (the intra prediction mode index in the lower left diagonal direction + M). In this regard, M may be determined based on the ratio of the current block. When the intra prediction mode for the current block belongs to the transformation range, the intra prediction mode may be transformed into a wide-angle intra prediction mode. The transformation may be to add a predefined value to the intra prediction mode, and the predefined value may be the total number of directional intra prediction modes excluding the wide-angle intra prediction mode (e.g., 65).

[0358] In the above example, the intra prediction modes numbered 2 to 15 may be transformed into wide-angle intra prediction modes numbered 67 to 80, respectively.

[0359] Hereinafter, the intra prediction mode belonging to the transform range is referred to as a wide-angle intra prediction alternative mode.

[0360] The transformation range may be determined based on the ratio of the current block. In an example, Tables 4 and 5 show transformation ranges for a case where 35 intra prediction modes other than the wide intra prediction mode are defined and a case where 67 intra prediction modes other than the wide intra prediction mode are defined, respectively.

[0361]

Table 4

[0362] condition Replace intra prediction mode W / H=2 Mode 2, 3, 4 W / H>2 Mode 2,3,4,5,6 W / H=1 none H / W=1 / 2 Mode 32,33,34 H / W<1 / 2 Mode 30,31,32,33,34

[0363]

Table 5

[0364] condition Replace intra prediction mode W / H=2 Mode 2,3,4,5,6,7 W / H>2 Mode 2,3,4,5,6,7,8,9,10,11 W / H=1 none H / W=1 / 2 Mode 61,62,63,64,65,66 H / W<1 / 2 Mode 57,58,59,60,61,62,63,64,65,66

[0365] As shown in the examples of Tables 4 and 5, the number of wide-angle intra prediction replacement modes included in the transform range may vary according to the ratio of the current block. The ratio of the current block may be further subdivided to set the transform range as shown in Table 6 below.

[0366]

Table 6

[0367] condition Replace intra prediction mode W / H=16 Mode 12,13,14,15 W / H=8 Mode 12,13 W / H=4 Mode 2,3,4,5,6,7,8,9,10,11 H / W=2 Mode 2,3,4,5,6,7 H / W=1 none W / H=1 / 2 Mode 61,62,63,64,65,66 W / H=1 / 4 Mode 57,58,59,60,61,62,63,64,65,66 W / H=1 / 8 Mode 55,56 H / W=1 / 16 Mode 53,54,55,56

[0368] When a non-adjacent reference sample line is determined as a reference sample line for a current block, or when a multi-line intra prediction encoding method for selecting one of a plurality of reference sample lines is used, the prediction method may be configured not to use the wide-angle intra prediction mode. That is, although the current block has a non-square shape and the intra prediction mode for the current block belongs to the transformation range, the intra prediction mode for the current block may not be transformed into the wide-angle intra prediction mode. Alternatively, when the intra prediction mode for the current block is determined as the wide-angle intra prediction mode, the prediction method may be configured so that the non-adjacent reference sample line is not used as a reference sample line for the current block, or may be configured not to use the multi-line intra prediction encoding method for selecting one of a plurality of reference sample lines. When the multi-line intra prediction encoding method is not used, the adjacent reference sample line may be determined as the reference sample line of the current block.

[0369] When the wide-angle intra prediction mode is not used, each of refW and refH may be set to the sum of nTbW and nTbH. Therefore, a non-adjacent reference sample line i lines away from the current block may include (nTbW+nTbH+offsetX[i]) upper reference samples and (nTbW+nTbH+offsetY[i]) left reference samples in addition to the upper left reference sample. That is, a non-adjacent reference sample line i lines away from the current block may include (2nTbW+2nTbH+offsetX[i]+offsetY[i]+1) reference samples. For example, when the value of whRatio is greater than 1, the value of offsetX may be set to a value greater than offsetY. In one example, when the value of offsetX may be set to 1, the value of offsetY may be set to 0. Conversely, when the value of whRatio is less than 1, the value of offsetY may be set to a value greater than offsetX. In one example, the value of offsetX may be set to 0, and the value of offsetY may be set to 1.

[0370] Since the wide-angle intra-frame prediction mode is used in addition to the conventional intra-frame prediction mode, resources used to encode the wide-angle intra-frame prediction mode may increase, and thus encoding efficiency may decrease. Therefore, instead of encoding the wide-angle intra-frame prediction mode as it is, an alternative intra-frame prediction mode for the wide-angle intra-frame prediction mode is encoded to improve encoding efficiency.

[0371] In an example, when the current block is encoded by using the wide-angle intra prediction mode numbered 67, number 2 (wide-angle replacement intra prediction mode numbered 67) may be encoded as the intra prediction mode for the current block. In addition, when the current block is encoded by using the wide-angle intra prediction mode numbered -1, number 66 (wide-angle replacement intra prediction mode numbered -1) may be encoded as the intra prediction mode for the current block.

[0372] The decoder may decode the intra prediction mode for the current block and determine whether the decoded intra prediction mode belongs to the transformation range. When the decoded intra prediction mode is the wide-angle replacement intra prediction mode, the intra prediction mode may be transformed into the wide-angle intra prediction mode.

[0373] Alternatively, when the current block is encoded by the wide-angle intra prediction mode, the wide-angle intra prediction mode may be encoded as it is.

[0374] The encoding of the intra prediction mode may be performed based on the above-mentioned MPM list. Specifically, when encoding a neighboring block in the wide-angle intra prediction mode, the MPM may be set based on the wide-angle replacement intra prediction mode corresponding to the wide-angle intra prediction mode.

[0375] A coding block or a transform block may be partitioned into a plurality of sub-blocks (or sub-partitions). When a coding block or a transform block is partitioned into a plurality of sub-blocks, prediction, transformation, and quantization may be performed for each sub-block. Partitioning a coding block or a transform block into a plurality of sub-blocks may be defined as a sub-partition intra coding method.

[0376] Information indicating whether the sub-partition intra coding method is applied may be signaled in the bitstream. The information may be a 1-bit flag. In an example, "intra_subpartitions_mode_flag" (a syntax factor indicating whether a coding block or a transform block is partitioned into multiple sub-blocks) may be signaled in the bitstream.

[0377] Optionally, whether the sub-partition intra-coding method is applied may be determined based on at least one of the size, shape, or intra-prediction mode of the coding block or the transform block. In an example, when the intra-prediction mode of the coding block is a non-directional intra-prediction mode (e.g., plane or DC) or a predefined directional intra-prediction mode (e.g., an intra-prediction mode in the horizontal direction, an intra-prediction mode in the vertical direction, or an intra-prediction mode in the diagonal direction), the sub-partition intra-coding method may not be applied. Optionally, when the size of the coding block is less than a threshold, the sub-partition intra-coding method may be set not to be used.

[0378] Optionally, when intra prediction for a subblock is performed based on an intra prediction mode of a coding block, whether the sub-partition intra coding method is applied may be determined based on whether a reconstructed sample included in a neighboring subblock should be used as a reference sample in intra prediction of the subblock. In an example, when the intra prediction mode of the coding block is an intra prediction mode in a diagonal direction or a wide-angle intra prediction mode, and a neighboring subblock may not be used as a reference sample in an operation of performing intra prediction for a subblock based on the intra prediction mode, the sub-partition intra coding method may be set not to be used.

[0379] Optionally, when the aspect ratio of the coding block is equal to or greater than a threshold or equal to or less than a threshold, the sub-partition intra-coding method may be set to not be used. Optionally, when at least one of the height or width of the coding block is equal to or less than a threshold, the sub-partition intra-coding method may not be used. In the example, when the width or height of the coding block is equal to or less than a threshold, or when both the height and width of the coding block are equal to or less than a threshold, the sub-partition intra-coding method may not be used. Optionally, when the number of samples included in the coding block is equal to or less than a threshold, the sub-partition intra-coding method may not be used. The threshold may have a predefined value in the encoder and the decoder. Optionally, information for determining the threshold may be signaled in a bitstream.

[0380] Alternatively, whether a flag indicating whether the sub-partition intra-coding method is applied is signaled may be determined based on at least one of the size, shape, or intra-prediction mode of the coding block or the transform block. In an example, a flag indicating whether the sub-partition intra-coding method is applied may be encoded and signaled only when both the height and width of the coding block are equal to or less than a threshold and / or when the size of the coding block is equal to or greater than a threshold. When the flag indicating whether the sub-partition intra-coding method is applied is not encoded, the sub-partition intra-coding method may not be applied.

[0381] When the subpartition intra coding method is not used, the operation of signaling the syntax factor intra_subpartitions_mode_flag may be omitted. When the operation of signaling the flag is omitted, the flag may be regarded as indicating that the subpartition intra coding method is not applied.

[0382] When the sub-partition intra encoding method is applied, the partition shape of the coding block or the transform block may be determined. In this case, the partition shape indicates the partition direction of the coding block or the transform block. In an example, partitioning in a vertical direction may indicate partitioning the coding block or the transform block by using at least one vertical line, and partitioning in a horizontal direction may indicate partitioning the coding block or the transform block by using at least one horizontal line.

[0383] Fig. 27: is a diagram showing an example of partitioning in a vertical direction and partitioning in a horizontal direction.

[0384] Fig. 27 (a) shows an example where a coding block is partitioned into two sub-blocks. Fig. 27 (b) shows an example in which a coding block is partitioned into 4 sub-blocks.

[0385] Information for determining the partition shape of a coding block or a transform block may be signaled in a bitstream. In an example, information indicating whether partitioning in the vertical direction is applied to a coding block or a transform block or whether partitioning in the horizontal direction is applied to a coding block or a transform block may be signaled. The information may be a 1-bit flag intra_subpart_type_flag. When the value of the flag is 1, this indicates that the coding block or the transform block is partitioned in the horizontal direction, and when the value of the flag is 0, this indicates that the coding block or the transform block is partitioned in the vertical direction.

[0386] Optionally, the partition shape of the coding block or transform block may be determined based on the size, shape, or intra prediction mode of the coding block or transform block. In the example, the partition shape of the coding block may be determined based on the aspect ratio of the coding block. For example, when the value whRatio representing the aspect ratio of the coding block is equal to or greater than a first threshold, the partition in the vertical direction may be applied to the coding block. Otherwise, the partition in the horizontal direction may be applied to the coding block.

[0387] Fig.28 is a diagram illustrating an example of determining a partition shape of a coding block.

[0388] For ease of description, it is assumed that the first threshold is 2. Fig.28 In the example shown in (a), the whRatio of the coding block is 1 which is less than the first threshold. Therefore, encoding of information indicating the partition shape of the coding block may be omitted, and partitioning in the horizontal direction may be applied to the coding block.

[0389] exist Fig.28 In the example shown in (b), the whRatio of the coding block is 2, which is the same as the first threshold. Therefore, encoding of information indicating the partition shape of the coding block can be omitted, and partitioning in the vertical direction can be applied to the coding block.

[0390] The partition shape of the coding block can be determined by using a second threshold with a sign opposite to the first threshold. In the example, when the value of whRatio is equal to or less than the second threshold, the partition in the horizontal direction can be applied to the coding block, otherwise, the partition in the vertical direction can be applied to the coding block. The absolute values ​​of the first threshold and the second threshold may be the same, and their signs may be different. In the example, when the first threshold is N (in this case, N is an integer such as 1, 2, 4, etc.), the second threshold may be -N.

[0391] Fig.29 is a diagram illustrating an example of determining a partition shape of a coding block.

[0392] For ease of description, it is assumed that the second threshold is -2. Fig.29 In the example shown in (a), the whRatio of the coding block is -1 which is greater than the second threshold value. Therefore, encoding of information indicating the partition shape of the coding block may be omitted, and partitioning in the vertical direction may be applied to the coding block.

[0393] exist Fig.29 In the example shown in (b), the whRatio of the coding block is -2 which is the same as the second threshold. Therefore, encoding of information indicating the partition shape of the coding block can be omitted, and partitioning in the horizontal direction can be applied to the coding block.

[0394] Optionally, the partition shape of the coding block may be determined based on a first threshold and a second threshold. In the example, when the value of whRatio is equal to or greater than the first threshold, the partition in the horizontal direction may be applied to the coding block, and when the value of whRatio is equal to or less than the second threshold, the partition in the vertical direction may be applied to the coding block. When the value of whRatio is between the first threshold and the second threshold, the partition shape of the current block may be determined by parsing the information in the bitstream.

[0395] The first threshold and the second threshold may be predefined in the encoder and the decoder. Alternatively, the first threshold and the second threshold may be defined per sequence, picture or slice.

[0396] Optionally, the partition shape may be determined based on the size of the coding block or the transform block. In the example, when the size of the coding block is N×n, partitioning in the vertical direction may be applied, and when the size of the coding block is n×N, partitioning in the horizontal direction may be applied. In this case, n may be a natural number less than N. N and / or n may be predefined values ​​in the encoder and decoder. Optionally, information for determining N and / or n may be signaled in a bitstream. In the example, N may be 32, 64, 128, or 256, etc. Therefore, when the size of the coding block is 128×n (in this case, n is a natural number such as 16, 32, or 64, etc.), partitioning in the vertical direction may be applied, and when the size of the coding block is n×128, partitioning in the horizontal direction may be applied.

[0397] Optionally, the partition shape of the coding block or the transform block may be determined based on the intra prediction mode of the coding block or the transform block. In an example, when the intra prediction mode of the coding block is in the horizontal direction or in a direction similar to the horizontal direction, the partition in the vertical direction may be applied to the coding block. In this case, the intra prediction mode in the direction similar to the horizontal direction means that the partition shape is different from the intra prediction mode in the horizontal direction (e.g., Fig.21 (b) INTRA_ANGULAR18) is equal to or less than the threshold value of the intra prediction mode (for example, INTRA_ANGULAR18±N). On the other hand, when the intra prediction mode of the coding block is in the vertical direction or in a direction similar to the vertical direction, the partition in the horizontal direction may be applied to the coding block. In this case, the intra prediction mode in the direction similar to the vertical direction means the intra prediction mode in the vertical direction (for example, Fig.21 (b) is equal to or less than a threshold value of the intra prediction mode (e.g., INTRA_ANGULAR50±N). In this case, the threshold value N may be a predefined value in the encoder and the decoder. Alternatively, information for determining the threshold value N may be signaled at the sequence level, the picture level, or the slice level.

[0398] When both partitioning in the vertical direction and partitioning in the horizontal direction are available, the division shape of the coding block may be determined by parsing information indicating the division shape of the coding block.

[0399] The number of sub-blocks may be determined based on at least one of the size or shape of the coding block or the transform block. In the example, when either the width or height of the coding block is 8 and the other is 4, the coding block may be partitioned into 2 sub-blocks. On the other hand, when both the width and height of the coding block are equal to or greater than 8, or when either the width or height of the coding block is greater than 8, the coding block may be partitioned into 4 sub-blocks. In short, when the coding block has a 4×4 size, the coding block may not be partitioned into sub-blocks. When the coding block has a 4×8 or 8×4 size, the coding block may be partitioned into 2 sub-blocks. Otherwise, the coding block may be partitioned into 4 sub-blocks.

[0400] Alternatively, information indicating the size or shape of the sub-block or the number of sub-blocks may be signaled in the bitstream. The size or shape of the sub-block may be determined by the information indicating the number of sub-blocks. Alternatively, the number of sub-blocks may be determined by the information indicating the size or shape of the sub-blocks.

[0401] When the sub-partition intra-coding method is applied, the sub-blocks generated by partitioning the coding block or the transform block can use the same intra-prediction mode. In an example, the MPM for the coding block can be derived based on the intra-prediction mode of the neighboring blocks adjacent to the coding block, and the intra-prediction mode for the coding block can be determined based on the derived MPM. When the intra-prediction mode of the coding block is determined, each sub-block can perform intra-prediction by using the determined intra-prediction mode.

[0402] When the sub-partition intra coding method is applied, any one of the MPMs may be determined as the intra prediction mode of the coding block. In other words, although the MPM flag is not signaled, when the sub-partition intra coding method is applied, the MPM flag may be considered true.

[0403] Optionally, when the sub-partition intra-coding method is applied, any one of the predefined candidate intra-prediction modes may be determined as the intra-prediction mode of the coding block. In the example, any one of the intra-prediction modes in the horizontal direction, the intra-prediction mode in the vertical direction, the intra-prediction mode in the diagonal direction (e.g., at least one of the upper left intra-prediction mode, the upper right intra-prediction mode, or the lower left intra-prediction mode) or the non-directional intra-prediction mode (e.g., at least one of the plane or DC) may be determined as the intra-prediction mode of the coding block. Index information specifying any one of the predefined candidate intra-prediction modes may be sent with a bitstream signal. Optionally, the number and / or type of candidate intra-prediction modes may be different depending on the partition direction of the coding block. In the example, when the partition in the horizontal direction is applied to the coding block, at least one of the non-directional intra-prediction mode, the intra-prediction mode in the vertical direction, the intra-prediction mode in the upper left diagonal direction, or the intra-prediction mode in the upper right diagonal direction may be set as the candidate intra-prediction mode. On the other hand, when partitioning in the vertical direction is applied to the coding block, at least one of a non-directional intra-frame prediction mode, an intra-frame prediction mode in the horizontal direction, an intra-frame prediction mode in the upper left diagonal direction, or an intra-frame prediction mode in the lower left diagonal direction may be set as a candidate intra-frame prediction mode.

[0404] The quantization parameters of the sub-blocks may be determined individually. Therefore, the value of the quantization parameter of each sub-block may be set differently. Information representing the difference from the quantization parameter of the previous sub-block may be encoded to determine the quantization parameter of each sub-block. In an example, for the Nth sub-block, the difference between the quantization parameter of the Nth sub-block and the quantization parameter of the N-1th sub-block may be encoded.

[0405] Intra-frame prediction of a sub-block may be performed by using reference samples. In this case, the reference samples may be derived from the reconstructed samples of a neighboring block adjacent to the sub-block. When the neighboring blocks adjacent to the sub-block are other sub-blocks included in the same coding block as the sub-block, the reference samples of the sub-block may be derived based on the reconstructed samples of the other sub-blocks. In the example, when the first sub-block is located to the left or above the second sub-block, the reference samples of the second sub-block may be derived from the reconstructed samples of the first sub-block. In this regard, parallel intra-frame prediction may not be applied between sub-blocks. In other words, encoding / decoding may be performed sequentially for the sub-blocks included in the coding block. Therefore, after encoding / decoding of the first sub-block is completed, intra-frame prediction for the second sub-block may be performed.

[0406] When the sub-partition intra coding method is applied, it may be set not to use the multi-line intra prediction coding method of selecting any one of the multiple reference sample line candidates. When the multi-line intra prediction coding method is not used, the adjacent reference sample line adjacent to each sub-block may be determined as the reference sample line of each sub-block. Optionally, when the index of the reference sample line of the current block is greater than 0, the encoding of the syntax factor intra_subpartitions_mode_flag indicating whether the sub-partition intra coding method is applied may be omitted. When the encoding of the syntax intra_subpartitions_mode_flag is omitted, the sub-partition intra coding method may not be applied.

[0407] The filtering may be performed on samples adjacent to the boundary between subblocks. The filtering may be performed on predicted samples or reconstructed samples. In an example, when it is assumed that the second subblock is adjacent to the right side of the first subblock, the predicted samples or reconstructed samples adjacent to the left boundary of the second subblock may be filtered by using the reconstructed samples adjacent to the right boundary of the first subblock.

[0408] Whether a filter is to be applied to samples adjacent to a boundary between subblocks may be determined based on at least one of an intra prediction mode, a size of a subblock, or the number of subblocks.

[0409] When a prediction block is generated by performing intra prediction, the prediction samples may be updated based on the position of each prediction sample included in the prediction block. Such an updating method may be referred to as an intra weighted prediction method based on sample position (or position dependent prediction combination PDPC).

[0410] Whether PDPC will be used can be determined by considering the size or shape of the current block, the intra prediction mode, the reference sample line of the current block, the size or color component of the current block. In the example, PDPC can be used when the intra prediction mode of the current block is at least one of plane, DC, vertical direction, horizontal direction, a mode with an index value less than the vertical direction, or a mode with an index value greater than the horizontal direction. Optionally, PDPC can be used only when at least one of the width or height of the current block is greater than 4. Optionally, PDPC can be used only when the index of the reference sample line of the current block is 0. Optionally, PDPC can be used only when the index of the reference sample line of the current block is equal to or greater than a predefined value. Optionally, PDPC can be used only for the brightness component. Optionally, whether to use PDPC can be determined based on whether two or more of the listed conditions are met.

[0411] Optionally, whether to use PDPC may be determined based on whether the sub-partition intra-coding method is used. In an example, when the sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may be set to not be used. Optionally, when the sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may be applied to at least one of a plurality of sub-blocks. In this case, the sub-block as the target of PDPC may be determined based on at least one of the size, shape, position, intra-prediction mode, or reference sample line index of the coding block or sub-block. In an example, PDPC may be applied to a sub-block adjacent to the upper boundary and / or left boundary of the coding block or to a sub-block adjacent to the lower boundary and / or right boundary of the coding block. Optionally, based on the size or shape of the sub-block, PDPC may be set to be applied to all sub-blocks included in the coding block, or PDPC may be set not to be applied to all sub-blocks included in the coding block. In an example, when at least one of the width or height of the sub-block is less than a threshold, the application of PDPC may be omitted. In another example, PDPC may be applied to all sub-blocks in the coding block.

[0412] Optionally, whether to apply PDPC may be determined for each sub-block based on whether at least one of the size, shape, intra-prediction mode, or reference picture index of a sub-block generated by partitioning a coding block or a transform block satisfies a preset condition. In the example, PDPC may be applied to the sub-block when at least one of the width or height of the sub-block is greater than 4.

[0413] In another example, information indicating whether PDPC is applied may be signaled in a bitstream.

[0414] Optionally, the area to which PDPC is applied may be determined based on at least one of the following items: the size, shape or intra-frame prediction mode of the current block, or the position of the prediction sample. In the example, when the intra-frame prediction mode of the current block has an index greater than the vertical direction, at least one of the prediction samples in the x-axis coordinate or the y-axis coordinate greater than the threshold may not be modified, and the modification may be performed only for the prediction samples whose x-axis coordinate or the y-axis coordinate is equal to or less than the threshold. Optionally, when the intra-frame prediction mode of the current block has an index less than the horizontal direction, at least one of the prediction samples in the x-axis coordinate or the y-axis coordinate greater than the threshold may not be modified, and the modification may be performed only for the prediction samples whose x-axis coordinate or the y-axis coordinate is equal to or less than the threshold. In this case, the threshold may be determined based on at least one of the size, shape or intra-frame prediction mode of the current block.

[0415] When the prediction sample is obtained through the intra prediction sample, the reference sample for modifying the prediction sample may be determined based on the position of the obtained prediction sample.

[0416] The residual signal may be obtained by taking a difference between the predicted sample and the original sample of the current block after performing intra prediction on the current block. In this case, after deriving the difference between the residual signal at a specific position and the adjacent residual signal, the derived difference may be encoded instead of encoding the residual signal at the specific position as it is. In this case, the residual signal may represent the residual sample, the transform coefficient generated by transforming the residual sample, or the coefficient generated by skipping the transform.

[0417] For example, encoding for the differential residual value may be performed after differencing the residual signal belonging to the first line and the residual signal belonging to the second line, rather than encoding the residual signal belonging to the second line as it is. In this case, at least one of the x-axis coordinate or the y-axis coordinate may be different for the first line and the second line.

[0418] In an example, the encoder may generate a transform coefficient by transforming the residual sample points, and encode the difference between the generated transform coefficient and the transform coefficient derived by taking the difference of the adjacent transform coefficients. The decoder may set the transform coefficient belonging to the first line as the transform coefficient prediction value for the second residual signal, and derive the second transform coefficient by adding the decoded difference transform coefficient to the transform coefficient prediction value.

[0419] As described above, when the residual difference value is encoded / decoded after differencing the residual signal, this may be referred to as intra BDPCM (Block-based Differential Pulse Code Modulation). Intra BDPCM may be used only when the prediction coding mode of the current block is determined to be intra prediction.

[0420] When intra BDPCM is applied, the prediction sample of the current block may be set to 0. In other words, when intra BDPCM is applied, the residual sample may be set to the reconstructed sample.

[0421] Optionally, when intra BDPCM is applied, the prediction samples of the current block may be derived based on intra prediction. In this case, the intra prediction mode of the current block may be determined according to the intra BDPCM direction. In the example, when the intra BDPCM direction is horizontal, the prediction samples may be obtained based on the intra prediction mode in the horizontal direction. When the intra BDPCM direction is vertical, the prediction samples may be obtained based on the intra prediction mode in the vertical direction.

[0422] Optionally, the prediction samples of the current block may be derived by using a default intra prediction mode. The default intra prediction mode may be any one of DC, planar, horizontal, or vertical. The default intra prediction mode may be predefined in the encoder and decoder. Information specifying one of the default intra prediction modes may be encoded and signaled.

[0423] Alternatively, the intra prediction mode may be derived from one MPM candidate among a plurality of MPM candidates.

[0424] When intra BDPCM is applied to the current block, the adjacent reference sample lines may be used compulsorily. In other words, the prediction samples may be obtained by omitting the operation of signaling the index information of one of the reference sample lines and by using the adjacent reference sample lines.

[0425] When the intra-frame BDPCM method is applied, information for determining the intra-frame BDPCM direction may be signaled in the bitstream. In an example, a flag intra_bdpcm_dir_flag indicating the intra-frame BDPCM direction may be signaled in the bitstream. When the syntax intra_bdpcm_dir_flag is 0, this indicates that BDPCM in the horizontal direction is applied, and when the syntax intra_bdpcm_dir_flag is 1, this indicates that BDPCM in the vertical direction is applied.

[0426] Alternatively, the intra-frame BDPCM direction may be determined based on the size or shape of the current block. In the example, when the current block has a non-square shape with a width greater than a height, it may be determined that the BDPCM in the horizontal direction is applied. On the other hand, when the current block has a non-square shape with a height greater than a width, it may be determined that the BDPCM in the vertical direction is applied.

[0427] Optionally, the intra-frame BDPCM direction may be determined by considering the intra-frame prediction mode of the neighboring block adjacent to the current block. In the example, when at least one intra-frame prediction mode of the left block and the upper block of the current block is in the horizontal direction or in a direction similar to the horizontal direction, the BDPCM in the horizontal direction may be applied to the current block. In this case, the direction similar to the horizontal direction represents an intra-frame prediction mode whose difference with the intra-frame prediction mode in the horizontal direction is equal to or less than a threshold. Optionally, when at least one intra-frame prediction mode of the left block and the upper block of the current block is in the vertical direction or in a direction similar to the vertical direction, the BDPCM in the vertical direction may be applied to the current block. In this case, the direction similar to the vertical direction represents an intra-frame prediction mode whose difference with the intra-frame prediction mode in the vertical direction is equal to or less than a threshold.

[0428] When BDPCM in the horizontal direction is applied, the difference between the residual signal and the residual signal adjacent to the upper side of the residual signal may be encoded. The decoder may derive the residual signal by adding the upper residual signal to the decoded difference.

[0429] When BDPCM in the vertical direction is applied, a difference between a residual signal and a residual signal adjacent to the left side of the residual signal may be encoded. The decoder may derive a residual signal by adding the left residual signal to the decoded difference.

[0430] Alternatively, non-directional BDPCM may be applied. In an example, DC BDPCM means encoding / decoding the difference between a residual signal at a predetermined position and an average value of adjacent residual signals at the predetermined position. Planar BDPCM means encoding / decoding an average or weighted summation result of a difference in the horizontal direction (a difference between a residual signal at a predetermined position and a residual signal in the horizontal direction of the residual signal at the predetermined position) and a difference in the vertical direction (a difference between a residual signal at a predetermined position and a residual signal in the vertical direction of the residual signal at the predetermined position).

[0431] Information for specifying an available BDPCM mode may be signaled in a bitstream. The information may be information indicating whether non-directional BDPCM is applied or information for specifying any one of a plurality of BDPCM candidates that may be applied to the current block.

[0432] Information indicating whether intra BDPCM is to be applied to the current block may be signaled in the bitstream. In an example, a flag intra_bdpcm_flag may be signaled in the bitstream. When the syntax intra_bdpcm_flag is 1, this indicates that intra BDPCM is applied to the current block. When the syntax intra_bdpcm_flag is 0, this indicates that intra BDPCM is not applied to the current block.

[0433] At the picture level or sequence level, information indicating the availability of intra BDPCM may be signaled. In an example, a flag sps_intra_bdpcm_flag indicating the availability of intra BDPCM may be signaled via a sequence parameter set (SPS). When the syntax sps_intra_bdpcm_flag is 1, this indicates that the picture of the reference sequence parameter set may use intra BDPCM. When the syntax sps_intra_bdpcm_flag is 0, this indicates that the picture of the reference sequence parameter set may not use intra BDPCM. Only when sps_intra_bdpcm_flag is 1, intra_bdpcm_flag indicating whether intra BDPCM is applied to the current block may be signaled.

[0434] When intra BDPCM is applied to the current block, PDPC may be set not to be used.

[0435] When intra BDPCM is applied to the current block, it may be set to forcibly apply transform skip. In other words, although transform_skip_flag indicating whether transform skip is applied is not signaled, the value may be considered as 1 when intra BDPCM is applied to the current block.

[0436] The combined prediction mode is a method of generating a predicted image by combining two or more prediction modes. In an example, when the combined prediction mode is applied, a prediction block may be generated by averaging a first prediction block generated based on a first prediction mode and a second prediction block generated based on a second prediction mode or by performing a weighted sum operation using them. The prediction mode may include at least one of an intra prediction mode, a merge mode, an AMVP mode, a skip mode, an intra block copy mode, or a palette mode. In an example, the first prediction mode may be a merge mode, and the second prediction mode may be an intra prediction mode.

[0437] When a combined prediction mode combining a merge mode and an intra prediction mode is used, a prediction block of the current block may be generated by weighted prediction of a first prediction block obtained based on motion information and a second prediction block obtained based on a predetermined intra prediction mode. The motion information of the current block may be derived from a merge candidate specified by merge_idx (an index signaled in a bitstream). The intra prediction mode of the current block may be set to a predefined intra prediction mode. The predefined intra prediction mode may be a plane mode, a DC mode, a horizontal mode, or a vertical mode. Optionally, the intra prediction mode of a neighboring block may be set to the intra prediction mode of the current block.

[0438] A flag indicating whether the combined prediction mode is applied to the current block may be signaled in the bitstream. In an example, the syntax ciip_flag may be signaled in the bitstream. When the value of the syntax ciip_flag is 1, this indicates that the combined prediction mode is applied to the current block. When the value of the syntax ciip_flag is 0, this indicates that the combined prediction mode is not applied to the current block. When the combined prediction mode is not applied to the current block, at least one of the merge offset coding method or the triangle partitioning method may be applied.

[0439] The residual image can be derived by subtracting the predicted image from the original image. In this regard, when the residual image is converted to the frequency domain, the subjective image quality of the image will not be significantly reduced even if the high-frequency components are removed from the frequency components. Therefore, when the value of the high-frequency component is transformed to a small value, or when the value of the high-frequency component is set to 0, the compression efficiency can be improved without causing large visual distortion. Reflecting the above characteristics, a transformation can be performed on the current block so as to decompose the residual image into two-dimensional frequency components. The transformation can be performed by using a transformation method such as DCT (discrete cosine transform), DST (discrete sine transform), etc.

[0440] DCT is used to decompose (or transform) the residual image into two-dimensional frequency components by using cosine transform, and DST is used to synthesize (or transform) the residual image into two-dimensional frequency components by using sine transform. As a result of transforming the residual image, the frequency components can be represented as basic images. In the example, when DCT transform is performed for a block of N×N size, N2 basic mode components can be obtained. The size of each basic mode component included in the basic mode components of the block of N×N size can be obtained by transformation. Depending on the transform method used, the size of the basic mode component can be referred to as a DCT coefficient or a DST coefficient.

[0441] The transform method DCT is mainly used to transform images with many non-zero low-frequency components. The transform method DST is mainly used to transform images with many high-frequency components.

[0442] The residual image may also be transformed by using a transform method other than DCT or DST.

[0443] Hereinafter, the operation of transforming the residual image into two-dimensional frequency components is referred to as two-dimensional image transformation. In addition, the size of the basic mode component obtained by the transformation is referred to as a transformation coefficient. In the example, the transformation coefficient may represent a DCT coefficient or a DST coefficient. When both the first transformation and the second transformation described later are applied, the transformation coefficient may represent the basic mode component generated by the result of the second transformation. In addition, the residual sample points skipped by applying the transformation are also referred to as transformation coefficients.

[0444] The transformation method may be determined in units of blocks. The transformation method may be determined based on at least one of a prediction coding mode of the current block, a size of the current block, or a shape of the current block. In an example, when the current block is encoded by an intra prediction mode and the size of the current block is less than N×N, the transformation may be performed by using a DST transformation method. On the other hand, when the condition is not met, the transformation may be performed by using a DCT transformation method.

[0445] For some blocks of the residual image, the two-dimensional image transform may not be performed. Not performing the two-dimensional image transform may be referred to as transform skipping. Transform skipping means that the first transform and the second transform are not applied to the current block. When transform skipping is applied, quantization may be applied to the residual values ​​for which the transform is not performed.

[0446] Whether transform skipping is allowed for the current block may be determined based on at least one of the size or shape of the current block. In an example, transform skipping may be applied only when the size of the current block is less than a threshold. The threshold is related to at least one of the width, height, or number of samples of the current block and may be defined as 32×32, etc. Optionally, transform skipping may be allowed only for square blocks. In an example, transform skipping may be allowed for square blocks of 32×32, 16×16, 8×8, or 4×4 size. Optionally, transform skipping may be allowed only when a sub-partition intra coding method is not used.

[0447] Alternatively, when the subpartition intra encoding method is applied to the current block, it may be determined whether transform skipping is applied for each subpartition.

[0448] Fig.30 is a diagram illustrating an example of determining whether to perform transform skip per sub-block.

[0449] Transform skipping may be applied to only a portion of the sub-blocks in the plurality of sub-blocks. Fig.30 In the example shown in , it may be set that the transformation is skipped and applied to the sub-block at the upper position of the current block, and the transformation is not skipped and applied to the sub-block at the lower position.

[0450] The transform type of the subblock for which transform skipping is not allowed may be determined based on information signaled in a bitstream. In an example, the transform type may be determined based on tu_mts_idx, which will be described later.

[0451] Optionally, the transform type of the sub-block may be determined based on the size of the sub-block. In an example, the horizontal transform type may be determined based on whether the width of the sub-block is equal to or greater than and / or equal to or less than a threshold, and the vertical transform type may be determined based on whether the height of the sub-block is equal to or greater than and / or equal to or less than a threshold.

[0452] Alternatively, information for determining a transform type may be signaled for a coding block, and the transform type specified by the information may be commonly applied to subblocks included in the coding block. In other words, the transform types of subblocks in the coding block may be set identically.

[0453] After the current block is transformed by using DCT or DST, the transformed current block may be transformed again. In this regard, the DCT or DST-based transform may be defined as a first transform, and the transform performed again on the block to which the first transform is applied may be defined as a second transform.

[0454] The first transform may be performed by using any one of a plurality of transform kernel candidates. In an example, the first transform may be performed by using any one of DCT2, DCT8, or DST7.

[0455] Different transform kernels may be used for the horizontal direction and the vertical direction. Information indicating a combination of a transform kernel in the horizontal direction and a transform kernel in the vertical direction may be signaled in a bitstream. In an example, the above tu_mts_idx may indicate one of the combinations of a transform kernel in the horizontal direction and a transform kernel in the vertical direction.

[0456] The processing unit of the first transform may be different from that of the second transform. In an example, the first transform may be performed on an 8×8 block, and the second transform may be performed on a 4×4 sized sub-block within the transformed 8×8 block. Optionally, the second transform may be performed on transform coefficients belonging to three 4×4 sized sub-blocks. The three sub-blocks may include a sub-block located at the upper left of the current block, a sub-block adjacent to the right of the sub-block, and a sub-block adjacent to the bottom of the sub-block. Optionally, the second transform may be performed on an 8×8 sized block.

[0457] The transform coefficients in the remaining regions where the second transform is not performed may also be set to zero.

[0458] Alternatively, the first transform may be performed on a 4×4 block, and the second transform may be performed on a region having a size of 8×8 including the transformed 4×4 block.

[0459] The information indicating the transform type of the current block may be signaled in a bitstream. The information may be index information tu_mts_idx indicating one of a combination of a transform type for a horizontal direction and a transform type for a vertical direction.

[0460] Based on the transform type candidates specified by the index information tu_mts_idx, a transform kernel for a vertical direction and a transform kernel for a horizontal direction may be determined. Table 7 represents transform type combinations according to tu_mts_idx.

[0461]

Table 7

[0462]

[0463] The transform type may be determined as one of DCT2, DST7, or DCT 8. Optionally, transform skip may be inserted in the transform type candidate.

[0464] When Table 7 is used, DCT2 may be applied in the horizontal direction and in the vertical direction when tu_mts_idx is 0. When tu_mts_idx is 2, DCT8 may be applied in the horizontal direction, and DCT7 may be applied in the vertical direction.

[0465] When the sub-partition intra encoding method is applied, the transform kernel of the sub-block may be determined independently. In an example, information for specifying a transform type combination candidate may be encoded and signaled per sub-block. Therefore, the transform kernel may be different between sub-blocks.

[0466] Optionally, the subblocks may use the same transform type. In this case, tu_mts_idx specifying the transform type combination candidate may be signaled only for the first subblock. Optionally, tu_mts_idx may be signaled at a coding block level, and the transform type of the subblock may be determined by referring to the tu_mts_idx signaled at the coding block level. Optionally, the transform type may be determined based on at least one of a size, a shape, or an intra prediction mode of one of the subblocks, and the determined transform type may be set for all subblocks.

[0467] Fig.31 is a diagram showing an example in which sub-blocks use the same transform type.

[0468] When the coding block is partitioned in the horizontal direction, the transform type of the sub-block (Sub-CU0) at the upper position of the coding block can be set to be the same as the transform type of the sub-block (Sub-CU1) at the lower position. Fig.31In the example shown in (a), when the horizontal transform type and the vertical transform type are determined based on tu_mts_idx signaled for the upper subblock, the determined transform type may also be applied to the lower subblock.

[0469] When the coding block is partitioned in the vertical direction, the transform type of the sub-block (Sub-CU0) at the left position of the coding block may be set to be the same as the transform type of the sub-block (Sub-CU1) at the right position. Fig.31 In the example shown in (b), when the horizontal transform type and the vertical transform type are determined based on tu_mts_idx signaled for the left subblock, the determined transform type may also be applied to the right subblock.

[0470] Whether the index information is encoded may be determined based on at least one of the following items: the size or shape of the current block, the number of non-zero coefficients, whether the second transform is performed, or whether the sub-partition intra encoding method is applied. In an example, when the sub-partition intra encoding method is applied to the current block, or when the number of non-zero coefficients is equal to or less than a threshold value, the operation of signaling the index information may be omitted. When the operation of signaling the index information is omitted, a default transform type may be applied to the current block.

[0471] The default transform type may include at least one of DCT2 or DST7. When there are multiple default transform types, one of the multiple default transform types may be selected by considering at least one of the following items: the size, shape, or intra-frame prediction mode of the current block, whether the second transform is performed, or whether the sub-partition intra-frame coding method is applied. In an example, one of the multiple transform types may be determined as a horizontal direction transform type based on whether the width of the current block is within a preset range, and one of the multiple transform types may be determined as a vertical direction transform type based on whether the height of the current block is within a preset range. Optionally, the default mode may be determined differently according to the size, shape, or intra-frame prediction mode of the current block or whether the second transform is performed.

[0472] Optionally, when there is only a transform coefficient of a DC component in the current block, the horizontal transform type and the vertical transform type may be set to a default transform type. In an example, when there is only a transform coefficient of a DC component in the current block, the horizontal transform type and the vertical transform type may be set to DCT2.

[0473] The threshold may be determined based on the size or shape of the current block. In an example, when the size of the current block is equal to or less than 32×32, the threshold may be set to 2, and when the current block is larger than 32×32 (e.g., when the current block is a 32×64 or 64×32 size coding block), the threshold may be set to 4.

[0474] A plurality of lookup tables may be pre-stored in the encoding device / decoding device. At least one of an index value assigned to a transform type combination candidate, a type of the transform type combination candidate, or the number of transform type combination candidates may be different for each of the plurality of lookup tables.

[0475] The lookup table for the current block may be selected based on at least one of the size, shape, or intra prediction mode of the current block, whether the second transform is applied, or whether transform skipping is applied to a neighboring block.

[0476] In an example, when the size of the current block is equal to or less than 4×4, or when the current block is encoded by inter-frame prediction, a first lookup table may be used, and when the size of the current block is greater than 4×4, or when the current block is encoded by intra-frame prediction, a second lookup table may be used.

[0477] Alternatively, information indicating one of the plurality of lookup tables may be signaled in a bitstream, and the decoding device may select a lookup table for the current block based on the information.

[0478] In another example, the index assigned to the transform type combination candidate may be adaptively determined based on at least one of the following items: the size, shape, prediction coding mode or intra prediction mode of the current block, whether the second transform is applied, or whether the transform skip is applied to the neighboring block. In the example, the index assigned to the transform skip when the size of the current block is 4×4 may be less than the index assigned to the transform skip when the size of the current block is greater than 4×4. Specifically, when the size of the current block is 4×4, index 0 may be assigned to the transform skip, and when the current block is greater than 4×4 and equal to or less than 16×16, an index greater than 0 (e.g., index 1) may be assigned to the transform skip. When the current block is greater than 16×16, a maximum value (e.g., 5) may be assigned to the index of the transform skip.

[0479] Alternatively, when the current block is encoded by inter prediction, an index of 0 may be assigned to the transform skip. When the current block is encoded by intra prediction, an index greater than 0 (eg, index 1) may be assigned to the transform skip.

[0480] Alternatively, when the current block is a 4×4 sized block encoded by inter-frame prediction, an index of 0 may be assigned to transform skip. On the other hand, when the current block is not encoded by inter-frame prediction, or when the current block is larger than 4×4, an index greater than 0 (e.g., index 1) may be assigned to transform skip.

[0481] A transform type combination candidate different from the transform type combination candidates listed in Table 7 may also be used. In an example, a transform type combination candidate consisting of a transform skip applied to one of a horizontal direction transform or a vertical direction transform and a transform kernel (such as DCT2, DCT8, or DST7, etc.) applied to the other of the horizontal direction transform or the vertical direction transform may be used. In this case, whether the transform skip is to be used as a transform type candidate for the horizontal direction or the vertical direction may be determined based on at least one of a size (e.g., width and / or height), a shape, a prediction coding mode, or an intra prediction mode of a current block.

[0482] Information indicating whether index information for determining a transform type of a current block is explicitly signaled may be signaled in a bitstream. In an example, information sps_explicit_intra_mts_flag indicating whether explicit transform type determination is allowed for a block encoded by intra prediction and / or information sps_explicit_inter_mts_flag indicating whether explicit transform type determination is allowed for a block encoded by inter prediction may be signaled at a sequence level.

[0483] When explicit transform type determination is allowed, the transform type of the current block may be determined based on the index information tu_mts_idx signaled in the bitstream. On the other hand, when explicit transform type determination is not allowed, the transform type may be determined based on at least one of the following items: the size or shape of the current block, whether the transform is allowed to be performed in units of sub-blocks, the position of the sub-block including the non-zero transform coefficient, whether the second transform is performed, or whether the sub-partition intra-coding method is applied. In the example, the horizontal transform type of the current block may be determined based on the width of the current block, and the vertical transform type of the current block may be determined based on the height of the current block. For example, when the width of the current block is less than 4 or greater than 16, the horizontal transform type may be determined as DCT2. Otherwise, the horizontal transform type may be determined as DST7. When the height of the current block is less than 4 or greater than 16, the vertical transform type may be determined as DCT2. Otherwise, the vertical transform type may be determined as DST7. In this case, a threshold to be compared with the width and height may be determined based on at least one of a size, a shape, or an intra prediction mode of the current block to determine a horizontal direction transform type and a vertical direction transform type.

[0484] Alternatively, when the current block has a square shape with the same height and width, the horizontal direction transform type and the vertical direction transform type may be set to be the same, but when the current block has a non-square shape with a height and a width different from each other, the horizontal direction transform type and the vertical direction transform type may be set differently. In an example, when the width of the current block is greater than the height, the horizontal direction transform type may be determined as DST7, and the vertical direction transform type may be determined as DCT2. When the height of the current block is greater than the width, the vertical direction transform type may be determined as DST7, and the horizontal direction transform type may be determined as DCT2.

[0485] The number and / or type of transform type candidates or the number and / or type of transform type combination candidates may differ depending on whether explicit transform type determination is allowed. In an example, when explicit transform type determination is allowed, DCT2, DST7, and DCT8 may be used as transform type candidates. Therefore, each of the horizontal direction transform type and the vertical direction transform type may be set to DCT2, DST7, or DCT8. When explicit transform type determination is not allowed, only DCT2 and DST7 may be used as transform type candidates. Therefore, each of the horizontal direction transform type and the vertical direction transform type may be determined to be DCT2 or DST7.

[0486] A coding block or a transform block may be partitioned into a plurality of subblocks, and transform may be performed only on a portion of the plurality of subblocks. An operation of applying transform to only a portion of the plurality of subblocks may be defined as a sub-transform block encoding method.

[0487] Fig.32 and Fig.33 is a diagram illustrating application aspects of the sub-transform block coding method.

[0488] Fig.32 is a diagram showing an example in which transformation is performed on only one sub-block among four sub-blocks, and Fig.33 is a diagram showing an example of performing transformation on only one of two sub-blocks. Fig.32 and Fig.33 In , it is assumed that the transformation is performed only on the sub-blocks marked as "target".

[0489] As in Fig.32 In the example shown in , after partitioning a coding block into 4 sub-blocks by using mutually orthogonal vertical and horizontal lines, transformation and quantization may be performed on only one of the sub-blocks. Transform coefficients in the sub-block on which transformation is not performed may be set to 0.

[0490] Optionally, as in Fig.33In the example shown in , after partitioning a coding block into 2 sub-blocks by using vertical lines or horizontal lines, transformation and quantization may be performed on only one of the sub-blocks. Transform coefficients in the sub-block on which transformation is not performed may be set to 0.

[0491] Information indicating whether a sub-transform block encoding method is applied to a coding block may be signaled in a bitstream. The information may be a 1-bit flag cu_sbt_flag. When the flag is 1, this indicates that the transform is performed only on a portion of the plurality of sub-blocks generated by partitioning the coding block or the transform block, and when the flag is 0, this indicates that the transform is performed without partitioning the coding block or the transform block into sub-blocks.

[0492] Whether the sub-transform block encoding method can be used for the coding block can be determined based on at least one of the following items: the size, shape or prediction coding mode of the coding block, or whether the combined prediction mode is used for the coding block. In an example, the sub-transform block encoding method can be used for the coding block when at least one of the following conditions is satisfied: at least one of the width or height of the coding block is equal to or greater than a threshold, inter-frame prediction is applied to the coding block, or the combined prediction mode is not applied to the coding block. In this case, the threshold value may be a natural number such as 4, 8, or 16.

[0493] Optionally, when the aspect ratio of the coding block is greater than a threshold, the sub-transform block coding method may not be allowed to be applied.

[0494] When intra prediction is applied to the coding block or when the intra block copy mode is applied, the sub-transform block encoding method may be determined to be unavailable.

[0495] Alternatively, whether the sub-transform block encoding method is available for the encoding block may be determined based on whether the sub-partition intra encoding method is applied to the encoding block. In an example, when the sub-partition intra encoding method is applied, the sub-transform block encoding method may be determined to be available.

[0496] When the sub-transform block coding method is determined to be applicable to the coding block, the syntax cu_sbt_flag may be signaled in the bitstream. According to the parsed value of cu_sbt_flag, it may be determined whether the sub-transform block coding method is applied.

[0497] On the other hand, when the sub-transform block encoding method is determined to be unavailable for the coding block, the operation of signaling the syntax cu_sbt_flag may be omitted. When the operation of signaling the syntax cu_sbt_flag is omitted, it may be determined that the sub-transform block encoding method is not applied to the coding block.

[0498] When the sub-transform coding method is applied to the coding block, information indicating the partition shape of the coding block may be signaled in a bitstream. The information indicating the partition shape of the coding block may include at least one of information indicating whether the coding block is partitioned into sub-blocks of 1 / 4 size, information indicating the partition direction of the coding block, or information indicating the number of sub-blocks.

[0499] In an example, when the syntax cu_sbt_flag is 1, a flag cu_sbt_quadtree_flag indicating whether the coding block is partitioned into sub-blocks of ¼ size may be signaled.

[0500] When the syntax cu_sbt_quadtree_flag is 1, this indicates that the coding block is partitioned into sub-blocks of 1 / 4 size. In the example, the coding block can be partitioned into sub-blocks of 1 / 4 width of the coding block and sub-blocks of 3 / 4 width of the coding block by using 1 vertical line, or the coding block can be partitioned into sub-blocks of 1 / 4 height of the coding block and sub-blocks of 3 / 4 height of the coding block by using 1 horizontal line. Optionally, the coding block may be partitioned into sub-blocks of 1 / 2 width and height of the coding block. When the coding block is partitioned into sub-blocks of 1 / 4 size, this may be referred to as type four partitioning. When the syntax cu_sbt_quad_tree_flag is 1, sub-blocks of 1 / 4 size of the coding block may be set as transform targets.

[0501] When the syntax cu_sbt_quadtree_flag is 0, this indicates that the coding block is partitioned to include sub-blocks of 1 / 2 size. In an example, the coding block can be partitioned into 2 1 / 2-sized sub-blocks by using 1 vertical line or 1 horizontal line. The operation of partitioning the coding block into 2 1 / 2-sized sub-blocks may be referred to as type 2 partitioning. When the value of the syntax cu_sbt_quad_tree_flag is 0, a 1 / 2-sized sub-block of the coding block may be included in the coding block.

[0502] In addition, a flag indicating the partition direction of the coding block can be signaled in the bitstream. In the example, a flag cu_sbt_horizontal_flag indicating whether horizontal partitioning is applied to the coding block can be encoded and signaled. When the value of cu_sbt_horizontal_flag is 1, this indicates that horizontal partitioning using at least one partition line parallel to the upper and lower sides of the coding block is applied. When the value of cu_sbt_horizontal_flag is 0, this indicates that vertical partitioning using at least one partition line parallel to the left and right sides of the coding block is applied.

[0503] According to the size or shape of the coding block, the partition shape of the coding block may be determined. In an example, when at least one of the width or height of the coding block is equal to or greater than a first threshold, the four-type partition may be available. In an example, the first threshold may be a natural number such as 4, 8, or 16. The first threshold may be referred to as a four-type threshold.

[0504] When the quad-type partition is determined to be available, the syntax cu_sbt_quadtree_flag may be signaled in the bitstream. According to the parsed value of cu_sbt_quadtree_flag, it may be determined whether the quad-type partition is applied to the coding block.

[0505] When the type-4 partition is determined to be unavailable, the operation of signaling the syntax cu_sbt_quadtree_flag may be omitted. When the operation of signaling the syntax cu_sbt_quadtree_flag is omitted, it may be determined that the type-2 partition is applied to the coding block.

[0506] Table 8 shows a syntax structure used to determine whether to parse the syntax cu_sbt_quadtree_flag.

[0507]

Table 8

[0508]

[0509]

[0510] In Table 8, the variable allowSbtVerQ indicates whether the four-type partition in the vertical direction is allowed, and the variable allowSbtHorQ indicates whether the four-type partition in the horizontal direction is allowed. The variables allowSbtVerQ and allowSbtHorQ can be determined based on the four-type threshold. In the example, when the four-type threshold is 16, allowSbtVerQ can be determined based on whether the width of the coding block is equal to or greater than 16, and allowSbtHorQ can be determined based on whether the height of the coding block is equal to or greater than 16.

[0511] As shown in the example of Table 8, when the variables allowSbtVerQ and allowSbtHorQ are both true, the syntax cu_sbt_quad_flag may be parsed from the bitstream. In the example, when the coding block is 16×8, the variable allowSbtHorQ is set to false, so the parsing of the syntax cu_sbt_quad_flag may be omitted. Alternatively, when the coding block is 8×16, the variable allowSbtVerQ is set to false, so the parsing of the syntax cu_sbt_quad_flag may be omitted. When the parsing of the syntax cu_sbt_quad_flag is omitted, type-two partitioning may be applied to the coding block.

[0512] Optionally, unlike the example shown in Table 8, the syntax cu_sbt_quad_flag may be parsed when either the variable allowSbtVerQ or the variable allowSbtHorQ is true. In other words, when only either the width and height of the coding block is equal to or greater than the type-four threshold, type-four partitioning may be available.

[0513] Optionally, although any one of the width or height of the coding block is equal to or greater than the first threshold, when the other of the width or height of the coding block is equal to or less than the second threshold, the four-type partition of the coding block may be determined to be unavailable. In this case, the second threshold may have a value less than the first threshold. In an example, the second threshold may be a natural number such as 2, 4, or 8.

[0514] The variable allowSbtHorH indicates whether the type 2 partition in the horizontal direction is available. When the height of the coding block is equal to or greater than the threshold, the type 2 partition in the horizontal direction can be set to available. The variable allowSbtVerH indicates whether the type 2 partition in the vertical direction is available. When the width of the coding block is equal to or greater than the threshold, the type 2 partition in the vertical direction can be set to available. In this case, the threshold can be a natural number such as 4, 8, or 16.

[0515] When both horizontal type partition / two type partition and vertical type partition / two type partition are available, the syntax cu_sbt_horizontal_flag may be signaled in the bitstream. Depending on the value of the syntax cu_sbt_horizontal_flag, partition in the horizontal direction or partition in the vertical direction may be applied to the coding block.

[0516] On the other hand, when only one of the four-type partitions / two-type partitions in the horizontal direction and the four-type partitions / two-type partitions in the vertical direction is available, the operation of signaling the syntax cu_sbt_horizontal_flag may be omitted. When the operation of signaling the syntax cu_sbt_horizontal_flag is omitted, the available one of the four-type partitions / two-type partitions in the horizontal direction and the four-type partitions / two-type partitions in the vertical direction may be applied.

[0517] When type 2 partitioning in the horizontal direction or type 2 partitioning in the vertical direction is not available, the operation of signaling the syntax cu_sbt_horizontal_flag may be omitted.

[0518] When the operation of signaling the syntax cu_sbt_horizontal_flag is omitted and the variable allowSbtHorH is true, type-2 partitioning in the horizontal direction may be applied to the coding block.

[0519] When the operation of signaling the syntax cu_sbt_horizontal_flag is omitted and the variable allowSbtVerH is true, type-2 partitioning in the vertical direction may be applied to the coding block.

[0520] Information for specifying a sub-block as a target of a transform among a plurality of sub-blocks may be sent as a bitstream signal. In an example, the syntax cu_sbt_pos_flag may be sent as a bitstream signal. The syntax cu_sbt_pos_flag indicates whether the transform target is the first sub-block in the coding block. In the example, when type-four partitioning / type-two partitioning in the horizontal direction is applied to the coding block, when cu_sbt_flag is 1, the leftmost sub-block is determined as the transform target, and when cu_sbt_flag is 0, the rightmost sub-block is determined as the transform target. When type-four partitioning / type-two partitioning in the vertical direction is applied to the coding block, when cu_sbt_pos_flag is 1, the topmost sub-block is determined as the transform target, and when cu_sbt_pos_flag is 0, the bottommost sub-block is determined as the transform target.

[0521] The transform type of the subblock may be determined by considering the partition direction of the coding block and the position of the subblock. In an example, when the coding block is partitioned in the vertical direction and a transform is performed on a subblock at a left position in the subblock, the horizontal direction transform type and the vertical direction transform type may be set differently.

[0522] Fig.34 and Fig.35 A horizontal direction transform type and a vertical direction transform type according to the position of a subblock that is a transform target are shown.

[0523] exist Fig.34 In the example shown in , when the subblock as the target of the transform includes the upper left sample point or the lower right sample point of the coding block, the horizontal direction transform type and the vertical direction transform type can be set to be the same. In the example, Fig.34 The example shown in shows that when the subblock as the target of transformation includes the upper left sample point of the coding block, the horizontal direction transform type and the vertical direction transform type are set to DCT8, and when the subblock as the target of transformation includes the lower right sample point of the coding block, the horizontal direction transform type and the vertical direction transform type are set to DST7.

[0524] When the subblock as the target of the transform includes the upper right sample point or the lower left sample point of the coding block, the horizontal direction transform type and the vertical direction transform type may be set differently. In the example, Fig.34 The example shown in shows that when the subblock as the target of transformation includes the upper right sample point of the coding block, the horizontal direction transform type is set to DST7, and the vertical direction transform type is set to DCT8. When the subblock as the target of transformation includes the lower left sample point of the coding block, the horizontal direction transform type is set to DCT8, and the vertical direction transform type is set to DST7.

[0525] and Fig.34 Unlike the example shown in , when a sub-block including an upper left sample point or a sub-block including a lower right sample point in the coding block is determined as a transform target, the horizontal transform type and the vertical transform type may be set differently, and when a sub-block including an upper right sample point or a sub-block including a lower left sample point in the coding block is determined as a transform target, the horizontal transform type and the vertical transform type may be set to be the same.

[0526] Fig.34 It is shown that a sub-block whose height and width are 1 / 2 of the coding block is set as a transformation target. Unlike the example shown, a sub-block whose width is the same as the coding block but whose height is 1 / 4 of the coding block or a sub-block whose height is the same as the coding block but whose width is 1 / 4 of the coding block may be set as a transformation target.

[0527] exist Fig.35 In the example shown in , when the subblock as the target of transformation includes the upper left sample point of the coding block, the horizontal direction transformation type and the vertical direction transformation type can be set differently. Fig.35 In the example shown in , when the two-type partition in the horizontal direction is applied and the upper sub-block is determined as the transform target, the horizontal direction transform type may be set to DST7, and the vertical direction transform type may be set to DCT7. When the two-type partition in the vertical direction is applied and the left sub-block is determined as the transform target, the horizontal direction transform type may be set to DCT8, and the vertical direction transform type may be set to DST7.

[0528] and Fig.35 Different from the example shown in , when the sub-block as the target of the transform includes the upper left sample point of the coding block, the horizontal direction transform type and the vertical direction transform type may be set to the same, and when the sub-block as the target of the transform includes the lower right sample point of the coding block, the horizontal direction transform type and the vertical direction transform type may be set differently.

[0529] When the subblock as the target of the transform includes the lower right sample of the coding block, the horizontal transform type and the vertical transform type may be set to be the same. Fig.35 In the example shown in , when the two-type partition in the horizontal direction is applied and the lower sub-block is determined as the transform target, the horizontal transform type and the vertical transform type may be set to DST7. When the two-type partition in the vertical direction is applied and the right sub-block is determined as the transform target, the horizontal transform type and the vertical transform type may be set to DST7.

[0530] As in the above example, whether the horizontal transform type and the vertical transform type are set to be the same may be determined according to the position of the subblock as the target of the transform in the coding block. In addition, the horizontal transform type and the vertical transform type may be determined according to the position of the subblock as the target of the transform in the coding block.

[0531] For a sub-block, encoding of information indicating whether there is a non-zero coefficient (e.g., CBF) may be omitted. When encoding of the CBF is omitted, whether a non-zero residual coefficient is included in each sub-block may be determined based on the position of the block on which the transform is performed. In the example, when a sub-block at a right or lower position in a coding block to which type-two partitioning is applied is determined as a transform target, a CBF value for a sub-block at a left or upper position may be inferred to be 0, and a CBF value for a sub-block at a right or lower position may be inferred to be 1. Alternatively, when a sub-block at a left or lower position in a coding block to which type-two partitioning is applied is determined as a transform target, a CBF value for a sub-block at a left or upper position may be inferred to be 1, and a CBF value for a sub-block at a right or lower position may be inferred to be 0.

[0532] The second transform may be performed on the block to which the first transform is performed. The second transform may be performed on an upper left area in the transform block to which the first transform has been applied.

[0533] If the residual coefficients on which the first transform and the second transform have been performed are encoded, the decoding apparatus may perform the second inverse transform as an inverse process of the second transform on the transform block, and perform the first inverse transform as an inverse process of the first transform on the transform block on which the second inverse transform has been performed.

[0534] Whether the second transform is applied to the current block may be determined based on at least one of the following items: the size of the current block, the number of residual coefficients, the coding mode or the intra prediction mode, or whether the sub-partition intra coding method is applied. The encoder may encode information indicating whether the second transform is applied and send the information to the decoder using a signal. Alternatively, the encoder and the decoder may determine whether the second transform is performed based on the same condition.

[0535] In an example, information indicating whether the second transform is performed may be signaled in a bitstream. Specifically, a flag indicating whether the second transform is performed or index information specifying whether the second transform is performed and a transform core for the second transform may be signaled.

[0536] Table 9 shows an example of signaling a flag lfnst_flag indicating whether the second transform is performed in a bitstream. When the value of the flag lfnst_flag is 0, this indicates that the second transform is not performed for the current block. On the other hand, when the value of the flag lfnst_flag is 1, this indicates that the second transform is performed for the current block.

[0537]

Table 9

[0538]

[0539]

[0540] Optionally, the syntax lfnst_idx may be signaled in the bitstream. When the value of the index lfnst_idx is 0, this indicates that the second transform is not performed for the current block. On the other hand, when the index lfnst_idx is greater than 0, this indicates that the second transform is performed for the current block. When the value of the index lfnst_idx is greater than 0, lfnst_idx may be used to specify a transform core for performing the second transform.

[0541] Alternatively, whether to perform the second transformation may be determined by comparing at least one of the width or height of the current block with a threshold. In an example, when the minimum value of the width and height of the current block is less than the threshold, the second transformation may not be performed. In this case, the threshold may be a natural number, such as 4, 8, or 16.

[0542] Alternatively, when the current block is encoded by inter prediction, the second transform may not be applied.

[0543] Alternatively, although the current block is encoded by intra prediction, the second transform may not be applied when matrix-based intra prediction is performed.

[0544] Alternatively, whether the second transform is performed may be determined based on whether the transform kernel in the horizontal direction is the same as the transform kernel in the vertical direction. In an example, the second transform may be performed only when the transform kernel in the horizontal direction is the same as the transform kernel in the vertical direction. Alternatively, the second transform may be performed only when the transform kernel in the horizontal direction is different from the transform kernel in the vertical direction.

[0545] Optionally, the second transform may be allowed only when a predefined transform kernel is used for the transform in the horizontal direction and the transform in the vertical direction. In an example, the second transform may be allowed when a DCT2 transform kernel is used for the transform in the horizontal direction and the transform in the vertical direction.

[0546] Optionally, when the subpartition intra encoding method is applied to the current block, the second transform is allowed only when a DCT2 transform kernel is used for the transform in the horizontal direction and the transform in the vertical direction.

[0547] Alternatively, it may be determined whether the second transform is performed based on the number of non-zero transform coefficients of the current block. In an example, when the number of non-zero transform coefficients of the current block is less than or equal to a threshold, it may be set not to use the second transform, and when the number of non-zero transform coefficients of the current block is greater than the threshold, it may be set to use the second transform. The second transform may be allowed to be used only when the current block is encoded by intra prediction.

[0548] Alternatively, it may be determined whether the second transform is performed based on the position of the last non-zero transform coefficient of the current block. In an example, when at least one of the x-axis coordinate or the y-axis coordinate of the last non-zero transform coefficient of the current block is greater than a threshold, or when at least one of the x-axis coordinate or the y-axis coordinate of the sub-block to which the last non-zero transform coefficient of the current block belongs is greater than a threshold, the second transform may not be performed. In this case, the threshold may be predefined in the encoder and the decoder. Alternatively, the threshold may be determined based on the size or shape of the current block.

[0549] Optionally, when there is only a transform coefficient of a DC component in the current block, it may be set not to perform the second transform. In this case, the DC component represents a transform coefficient at an upper left position in the current block.

[0550] Whether to perform the second transform may be determined based on whether the combined prediction encoding mode is applied to the current block. In an example, when the combined prediction encoding mode is applied to the current block, it may be set not to perform the second transform.

[0551] Alternatively, when the combined prediction encoding mode is applied, whether to perform the second transform may be determined based on at least one of the size or shape of the current block, the intra prediction mode, or the weight.

[0552] Optionally, when the combined prediction coding mode is applied, it may be configured to signal information indicating whether the second transform is performed on the current block. For example, when the combined prediction coding mode is applied to the current block, the index lfnst_idx may be signaled.

[0553] Alternatively, it may be determined whether to perform the second transform regardless of whether the combined prediction encoding mode is applied.

[0554] Alternatively, whether to allow the second transform may be determined based on whether the subpartition intra encoding method is applied to the current block. In an example, when the subpartition intra encoding method is applied to the current block, it may be set not to apply the second transform to the current block.

[0555] Optionally, when the sub-partition intra-frame coding method is applied to the current block, it may be set to apply the second transform. For example, when the vertical partition or the horizontal partition is applied to the current block, the index information indicating whether the second transform is applied to the current block may be sent by a signal. Whether the second transform is applied and / or the transform kernel used for the second transform may be determined by the index information. On the other hand, when the sub-partition intra-frame coding method is not applied to the current block, the encoding of the index information may be omitted. Optionally, when the sub-partition intra-frame coding method is not applied to the current block, it may be determined whether the index information indicating whether the second transform is applied is encoded based on whether a preset condition is satisfied. In this case, the preset condition may be related to at least one of the position of the non-zero coefficient, the number of non-zero coefficients, or the size of the current block. In the example, when the number of non-zero coefficients is equal to or greater than 1, when the number of non-zero coefficients is 1 but is not included in the upper left region of the 4×4 of the current block, or when the scanning order of the non-zero coefficients (the non-zero coefficients are not included in the 4×4 region of the current block) is equal to or less than a threshold, the index information may be encoded and sent by a signal. Otherwise, encoding of the index information may be omitted.

[0556] When the index information is not signaled, the value of the index information may be inferred to indicate that the second transform is not applied.

[0557] Optionally, whether to apply the second transform may be determined based on at least one of the size, width, height or shape of the sub-block. In the example, when at least one of the size, width or height of the sub-block is less than a threshold, it may be set not to apply the second transform. Specifically, when at least one of the size, width or height of the sub-block is less than a threshold, encoding of the index information may be omitted. Information indicating whether the second transform is performed may be signaled at the coding block level. Whether the second transform will be applied to the sub-block belonging to the coding block may be determined based on the information signaled at the coding block level.

[0558] The threshold value may have a predefined value in the encoder and the decoder. In an example, the threshold value may be set to 2, 4, or 8, etc. Alternatively, the threshold value may be determined based on at least one of a partition direction of the current block or the number of subblocks included in the current block.

[0559] Alternatively, whether to encode the syntax indicating whether the second transform is applied may be determined by using the above-listed parameters related to the current block for determining whether the second transform is applied.

[0560] In an example, when at least one of the size of the current block, the number of residual coefficients, the coding mode or the intra prediction mode, or whether the sub-partition intra coding method is applied does not satisfy a preset condition, the encoding of the syntax indicating whether the second transform is applied may be omitted. In an example, the encoding of lfnst_flag or lfnst_idx may be omitted, and its value may be inferred to be 0. In other words, when the encoding of the syntax is omitted, the second transform may not be applied.

[0561] When intra BDPCM is applied to the current block, the second transform may not be performed. When intra BDPCM is applied to the current block, the operation of signaling a syntax element indicating whether the second transform is performed may be omitted, and its value may be derived as 0. Table 10 shows an example of omitting the operation of signaling lfnst_idx for a block to which intra BDPCM is applied.

[0562]

Table 10

[0563]

[0564]

[0565] Alternatively, when intra BDPCM is applied to the current block, the operation of signaling a syntax element (e.g., transform_skip_flag) indicating whether transform skipping is performed may be omitted. When intra BDPCM is applied to the current block, the operation of signaling the flag transform_skip_flag may be omitted, and its value may be inferred to be 1. In other words, when intra BDPCM is applied, transform may not be applied to the current block.

[0566] When it is determined that the transform is not applied to the current block, both the first transform and the second transform may not be applied. Therefore, when the transform of the current block is skipped, the operation of signaling the syntax element indicating whether the second transform is performed may be omitted, and its value may be inferred to be 0. Finally, when intra BDPCM is applied to the current block, the operation of signaling the syntax element lfnst_idx indicating whether the second transform is performed may be omitted.

[0567] Based on the above description, a method of performing the second transform in an encoder and a decoder will be described in detail.

[0568] The second transform may be performed on the upper left region in the current block. The target region to which the second transform is applied may have a predefined size or a predefined shape. The target region to which the second transform is applied may have a square block shape such as 4×4 or 8×8 or a non-square block shape such as 4×8 or 8×4.

[0569] Optionally, when the current block is evenly partitioned into N regions, at least one of the N regions may be set as the target region. In this case, N may be a natural number such as 2, 4, 8, or 16. The variable N may be predefined in the encoder and the decoder. Optionally, the variable N may be determined based on the size and / or shape of the current block.

[0570] Alternatively, the target region may be determined based on the number of transform coefficients. In an example, a predetermined number of transform coefficients may be determined as the target region according to a predetermined scanning order.

[0571] Optionally, information for specifying the size and / or shape of the target region may be encoded and transmitted in a bitstream. The information may include at least one of information indicating the size of the target region or information indicating the number of 4×4 blocks included in the target region.

[0572] Alternatively, the entire current block may be set as the target region. In an example, when the size of the current block is the same as the minimum size (eg, 4×4) of the target region, the entire current block may be set as a target for the second transform.

[0573] The second transform may be applied in a non-separable shape. Therefore, the second transform may also be referred to as a non-separable second transform (NSST).

[0574] Transform coefficients in the region to which the second transform is applied may be arranged in a single column. In an example, when the second transform is performed on a target region of N×N size, the transform coefficients included in the target region may be converted into N 2 ×1 size input matrix. When a 4×4 size block is set as the target region, the transform coefficients included in the target region may be converted into a 16×1 size input matrix. When an 8×8 size block is set as the target region, the transform coefficients included in the target region may be converted into a 64×1 size input matrix.

[0575] The non-separable transform matrix may be applied to an input matrix generated by arranging transform coefficients included in a target region in one line. The size of the non-separable transform matrix may be differently determined according to the size of the input matrix.

[0576] In the example, when the input matrix size is N 2 ×1, based on N 2 ×N 2 For example, when the size of the input matrix is ​​16×1, a 16×16 sized non-separable transformation matrix may be used, and when the size of the input matrix is ​​64×1, a 64×64 sized non-separable transformation matrix may be used.

[0577] The plurality of non-separable transform matrices may be stored in the encoder and the decoder. Information for specifying any one of the plurality of non-separable transform matrices may be signaled in a bitstream.

[0578] Alternatively, the non-separable transform matrix may be specified based on at least one of a size, a shape, a quantization parameter, an intra prediction mode, or a transform type of the current block used in the first transform.

[0579] Alternatively, a non-separable transform matrix candidate that can be used by the current block may be specified based on at least one of a size, a shape, a quantization parameter, an intra prediction mode, or a transform type of the current block used in the first transform. When there are a plurality of non-separable transform matrix candidates that can be used by the current block, information indicating one of the plurality of non-separable transform matrix candidates may be encoded and signaled.

[0580] The transformation matrix may be obtained by multiplying the non-separable transformation matrix by the input matrix. In an example, Equation 6 shows an example of obtaining the transformation matrix A'.

[0581] [Equation 6]

[0582] A′=T*A

[0583] In Equation 6, T represents a non-separable transformation matrix, and A represents an input matrix. When the size of the matrix T is N 2 ×N 2 And the size of matrix A is N 2 ×1, you can get N 2 In an example, when a 16×1 input matrix and a 16×16 non-separable transformation matrix are used, a 16×1 transformation matrix A' may be obtained. Alternatively, when a 64×1 input matrix and a 64×64 non-separable transformation matrix are used, a 64×1 transformation matrix A' may be obtained.

[0584] When the transformation matrix A' is obtained, the components in the transformation matrix A' may be set to the transformation coefficients of the N×N size block in the current block. The transformation coefficients in the remaining areas not including the N×N size block may be set to default values. In an example, the transformation coefficients in the areas where the second transformation is not performed may be set to 0.

[0585] The second transformation may be performed by using a non-separable transformation matrix in which the number of rows is smaller than the number of columns. 2 )-sized non-separable transformation matrix can be applied to (N 2 ×1) size. In this case, k can have a size smaller than N 2 In this example, k can be N 2 / 2、N 2 / 4 or 3N 2 / 4, etc. k may be referred to as a reduction factor.

[0586] As a result, a transformation matrix having a (k×1) size smaller than the input matrix may be obtained. Thus, a second transform outputting a transformation matrix having a size smaller than the input matrix may be referred to as a reduced second transform.

[0587] Equation 7 represents an example of applying a down-scaling second transform.

[0588] [Equation 7]

[0589] A R =R*A

[0590] In Equation 7, R represents k×N 2 The number of rows k is smaller than the number of columns N 2 The non-separable transformation matrix of A can be called a reduced non-separable transformation matrix. R Represents a transformation matrix of size k×1. The size is smaller than the transformation matrix A of the input matrix A. R It can be called a reduction transform matrix.

[0591] When the reduction transformation matrix A is obtained R When the reduction transformation matrix A R The components in are set to the transform coefficients of at least one or more M×M-sized blocks in the current block. In this case, M may be a natural number less than N. The number of M×M-sized blocks may be determined according to the reduction factor k. The transform coefficients of the remaining regions not including at least one M×M-sized block may be set to default values. In an example, the transform coefficients in the remaining regions may be set to 0.

[0592] Fig.36 is a diagram showing aspects of encoding of transform coefficients when the reduction factor is 16.

[0593] Transform coefficients included in a target region of 8×8 size may be transformed into an input matrix of 64×1 size, and a transform matrix of 16×1 size may be obtained by using a non-separable transform matrix of 16×64 size.

[0594] A transform matrix of a 16×1 size may be set as a transform coefficient of a 4×4 block, and transform coefficients in other regions may be set to zero.

[0595] Although not shown, when the reduction factor k is 32, a transform matrix of a 32×1 size may be set as a transform coefficient of an 8×4 block or a 4×8 block, and transform coefficients in other regions may be set to zero.

[0596] When the reduction factor k is 48, a transform matrix of a size of 48×1 may be set to transform coefficients of three 4×4 blocks, and transform coefficients in other regions may be set to 0. Specifically, the transform matrix may be set to transform coefficients of a 4×4 block at an upper left position of the current block, a 4×4 block adjacent to the right of the upper left block, and a 4×4 block adjacent to the lower side of the upper left block.

[0597] The transform matrix may be determined based on at least one of the following: a size or shape of the current block, or an intra prediction mode. In an example, based on the intra prediction mode of the current block, a transform matrix set may be determined, and one of a plurality of transform matrix candidates included in the transform matrix set may be selected. Index information specifying a transform matrix applied to the current block from among the plurality of transform matrix candidates may be encoded and signaled.

[0598] When the remaining transform coefficients excluding the transform coefficient generated by the second transform are set to 0, the decoder may determine whether to perform the second transform based on the position of the last non-zero residual coefficient. In an example, when the last residual coefficient is located outside the block storing the transform coefficient generated by the second transform, it may be determined that the second transform is not performed. In other words, the decoder may perform an inverse transform for the second transform only when the last residual coefficient is located in the block storing the transform coefficient generated by the second transform.

[0599] Whether to perform a reduced second transform may be determined based on at least one of a size or a shape of the current block. In an example, when at least one of a width or a height of the current block is greater than a threshold, a reduced second transform may be applied, otherwise, a general second transform may be applied. In this case, the threshold may be a natural number such as 4, 8, or 16.

[0600] Alternatively, whether to perform a reduced second transform may be determined according to the size of the target region. In an example, when the second transform is performed for a target region of 4×4 size, a general second transform may be applied. In an example, for a target region of 4×4 size, the second transform may be performed by using a non-separable transform matrix of 16×16 size.

[0601] On the other hand, when the second transform is performed for a target region of 8×8 size, a downscaled second transform may be applied. In an example, for a target region of 8×8 size, the second transform may be performed by using a non-separable transform matrix of 48×64, 32×64 or 16×64 size.

[0602] When performing an inverse transform for the reduced second transform, the size of the output matrix has a value greater than the size of the input matrix. In an example, when the reduction factor k is 16, an output matrix of 64×1 size may be obtained by performing an inverse transform for an input matrix of 16×1 size.

[0603] When the sub-partition intra encoding method is applied to the coding block, the coding block may be partitioned into a plurality of sub-blocks. When the sub-partition intra encoding method is applied to the coding block, it may be set not to apply the second transform.

[0604] Alternatively, whether to perform the second transform may be determined based on the shape or size of the sub-partition. In the example, when the coding block is partitioned into sub-partitions with a width or height of 4, the second transform may be applied. In other words, the second transform may be applied only when the sub-partition has a shape of 4×L or L×4. In this case, L represents an integer equal to or greater than 4.

[0605] Optionally, the second transformation may be applied only when the minimum of the width and height of the sub-partition is equal to or greater than a predefined threshold. In this case, the threshold may be an integer such as 4, 8 or 16.

[0606] As in the above example, when the shape or size of the sub-partition satisfies a predefined condition, information indicating whether the second transform is applied can be signaled in the bitstream. In the example, when the sub-partition is 4×L or L×4, or when the minimum value of the width and height of the sub-partition is equal to or greater than a threshold, the syntax lfnst_idx indicating whether the second transform is performed can be signaled.

[0607] On the other hand, when the shape or size of the sub-partition does not satisfy the predefined condition, the encoding / decoding of the information indicating whether the second transform is applied may be omitted. In an example, when the minimum value of the width and height of the sub-partition is less than a threshold, the encoding / decoding of the syntax lfnst_idx may be omitted. When the encoding / decoding of the syntax lfnst_idx is omitted, its value may be derived as 0.

[0608] When it is determined that the second transform is applied, the second transform may be applied to a subblock at a predefined position in the coding block or a subblock whose partition index is less than a threshold. In this case, the partition index of the left subblock may be set to have a value less than the partition index of the right subblock, or the partition index of the upper subblock may be set to have a value less than the partition index of the lower subblock. In an example, the second transform may be applied only to the first subblock in the coding block.

[0609] Alternatively, the second transform may be applied to each of all sub-blocks.

[0610] Optionally, when it is determined to perform the second transform at the coding block level, it may be adaptively determined whether to apply the second transform to each sub-block based on the attribute of each sub-block. In this case, the attribute of the sub-block may include at least one of the following items: the number of residual coefficients included in the sub-block, whether transform skipping is applied to the sub-block, or whether a transform kernel is applied to the sub-block.

[0611] The size of the target region for the second transform may be determined based on the size of the subblock. In an example, a 4×4-sized block including 16 samples, two 4×4-sized blocks including 32 samples, three 4×4-sized blocks including 48 samples, or four 4×4-sized blocks including 64 samples may be set as the target region for the second transform. Depending on the size of the target region, a general second transform may be applied, or a reduced second transform may be applied.

[0612] The size of the target region for the second transformation may be determined based on the size of the sub-block. In an example, when at least one of the width or height of the sub-block is less than a threshold value, an area including N samples may be set as the target region for the second transformation. On the other hand, when the width and height of the sub-block are equal to or greater than the threshold value, an area including M samples may be set as the target region for the second transformation. In this case, M may be a natural number greater than N. In an example, N may be 16 or 32, and M may be 48 or 64. In addition, the threshold value may be a natural number such as 2, 4, 8, or 16.

[0613] The target region for the second transform may be set not to extend beyond the boundary of the sub-block. In other words, when the target region for the second transform spans two or more sub-blocks, the second transform may be set not to be performed.

[0614] Fig.37 and Fig.38 is a diagram showing a target area for a second transformation.

[0615] When partitioning in the horizontal direction is applied to a 16×16 sized coding block, the coding block may be partitioned into 16×4 sized sub-blocks. As in the example shown, when the sub-block has an N×4 size (N is an integer greater than 4), the height of the target region for the second transform may be set to not more than 4.

[0616] In other words, if Fig.37 In the example shown in (a), the target region for the second transform may be set to a region of 4×4 or 8×4 size.

[0617] On the other hand, as in Fig.37 In the example shown in (b), setting of a target area for the second transform, such as 4×8 or 8×8, may not be allowed.

[0618] When partitioning in the vertical direction is applied to a 16×16 sized coding block, the coding block may be partitioned into 4×16 sized sub-blocks. As in the example shown, when the sub-block has a 4×N size (N is an integer greater than 4), the width of the target region for the second transform may be set to not more than 4.

[0619] In other words, if Fig.38 In the example shown in (a), the target region for the second transform may be set to a region of 4×4 or 4×8 size.

[0620] On the other hand, as in Fig.38 In the example shown in (b), setting of a target area for the second transform, such as 8×4 or 8×8, may not be allowed.

[0621] The decoder may decode the residual coefficients in the bitstream and derive transform coefficients by performing inverse quantization on the residual coefficients. When the transform coefficients are generated by the first transform and the second transform, residual samples may be derived by performing the second inverse transform and the first inverse transform on the transform coefficients.

[0622] When it is determined that the second transform is performed on the current block, a target region as a target of the second inverse transform may be determined. When the general second transform is applied, the size of the target region for the second inverse transform may be set to be the same as the size of the target region for the second transform. In an example, when the second transform is performed on a 4×4 sized region by using a 16×16 sized inseparable transform matrix, the second inverse transform may be applied to a 4×4 sized region.

[0623] On the other hand, when the reduced second transform is applied, the size of the target region for the second inverse transform may have a value smaller than the size of the target region for the second transform. In an example, when the second transform is performed on an 8×8 sized region by using a 64×48 sized reduced transform matrix, the second inverse transform may be performed on a region including 48 samples (e.g., three 4×4 sized blocks).

[0624] In the decoder, the target area for the second inverse transform may be determined based on the size of the current block. In this case, the current block may represent a coding block or a transform block as a target for performing the second inverse transform. In an example, when at least one of the width or height of the current block is less than a threshold, the target area may be configured to include 16 samples. On the other hand, when the width and height of the current block are equal to or greater than the threshold, the target area may be configured to include 48 samples.

[0625] The input matrix may be generated by arranging the transform coefficients included in the target area into a row. In this case, when the reduced second transform is applied to the current block, the input matrix may be generated based on as many transform coefficients as the reduction factor k. In the example, when the reduction factor k is 16, the input matrix may be generated based on the transform coefficients included in the upper left block of 4×4 size. When the reduction factor k is 32, the input matrix may be generated based on the transform coefficients included in the upper left block and the 4×4 size neighboring blocks adjacent to the right or below the upper left block. When the reduction factor k is 48, the input matrix may be generated based on the transform coefficients of the upper left block, the 4×4 size neighboring blocks adjacent to the right of the upper left block, and the 4×4 size neighboring blocks adjacent to the below of the upper left block.

[0626] The reduction factor k may be predefined in the encoder and the decoder. Alternatively, information for determining the reduction factor k may be signaled in the bitstream. Alternatively, the reduction factor k may be determined based on the size or shape of the current block.

[0627] The transformation matrix may be obtained by multiplying the input matrix with the non-separable inverse transformation matrix. The non-separable inverse transformation matrix may be a symmetric matrix of the non-separable transformation matrix shown in Equations 6 to 7. Equations 8 and 9 show examples of obtaining the transformation matrix by using the non-separable inverse transformation matrix.

[0628] [Equation 8]

[0629] A′=T T *A When the general second transform is applied to the current block, it can be obtained by multiplying the input matrix A by the non-separable inverse transform matrix T T In this example, the inverse transformation matrix T of size 16×16 can be derived. TMultiply with the 16×1 input matrix A to derive a 16×1 transformation matrix.

[0630] When the transform matrix A' is obtained, the components in the transform matrix A' may be set to transform coefficients of an NxN sized block in the current block. In an example, a 16x1 sized transform matrix may be set to transform coefficients of a 4x4 block.

[0631] [Equation 9]

[0632] A′=R T *A

[0633] When the reduced second transform is applied to the current block, the input matrix A can be multiplied by the reduced non-separable inverse transform matrix R T To derive the transformation matrix A'. In the example, the reduced non-separable inverse transformation matrix R of 64×16 size can be obtained by T Multiply with the 16×1 input matrix A to derive a 64×1 transformation matrix.

[0634] Alternatively, the reduced non-separable inverse transform matrix R of size 64×32 can be obtained by T Multiply with the 32×1 input matrix A to derive a 64×1 transformation matrix.

[0635] Alternatively, the reduced non-separable inverse transform matrix R of size 64×48 can be obtained by T Multiply it with the 48×1 input matrix A to derive a 48×1 transformation matrix.

[0636] When the transform matrix A' is obtained, the components in the transform matrix A' may be set to transform coefficients of a block of NxN size in the current block. In an example, a transform matrix of 64x1 size may be set to transform coefficients of a block of 8x8.

[0637] The non-separable inverse transform matrix may be determined based on at least one of the index information signaled in the bitstream or the size of the current block or the intra prediction mode. In an example, the size of the non-separable inverse transform matrix may be determined based on the size of the current block, and the non-separable inverse transform matrix set may be determined based on the intra prediction mode of the current block. When the non-separable inverse transform matrix set is determined by the intra prediction mode of the current block, at least one non-separable inverse transform matrix candidate among a plurality of non-separable inverse transform matrix candidates corresponding to the size of the current block included in the non-separable inverse transform matrix set may be specified by the index lfnst_idx.

[0638] The non-separable inverse transform matrix set may include a plurality of non-separable inverse transform matrix candidates. In this case, at least one of the type or number of inverse transform matrix candidates may be different between non-separable inverse transform matrix sets having different indices.

[0639] Table 11 shows an example of determining a non-separable inverse transform set based on an intra prediction mode. In Table 11, predModeIntra represents an index of an intra prediction mode, and lfnstTrSetIdx represents an index of the non-separable inverse transform set.

[0640]

Table 11

[0641] predModeIntra lfnstTrSetIdx predModeIntra<0 1 0<=predModeIntra<=1 0 2<=predModeIntra<=12 1 13<=predModeIntra<=23 2 24<=predModeIntra<=44 3 45<=predModeIntra<=55 2 56<=predModeIntra<=80 1 81<=predModeIntra<=83 0

[0642] In an example, when the intra prediction mode of the current block is planar, a non-separable inverse transform matrix set may be selected with an index of 0. Thereafter, the non-separable inverse transform matrix may be determined based on the size of the current block and the value of lfnst_idx.

[0643] The set of inseparable inverse transforms may be determined by further simplifying Table 11. In an example, Table 11 may be simplified as in Table 12.

[0644]

Table 12

[0645] predModeIntra lfnstTrSetIdx predModeIntra<0 1 0<=predModeIntra<=1 0 2<=predModeIntra<50 1 50<=predModeIntra<=83 2

[0646] Alternatively, the non-separable inverse transform matrix set may be selected by only considering whether the intra prediction mode is directional or non-directional. Table 13 shows an example of determining the non-separable inverse transform matrix set based on whether the intra prediction mode is directional or non-directional.

[0647]

Table 13

[0648] predModeIntra lfnstTrSetIdx 0<=predModeIntra<=1 0 other 1

[0649] Optionally, after storing a plurality of lookup tables defining a mapping relationship between an intra prediction mode and a non-separable inverse transform matrix set, the non-separable inverse transform matrix set can be determined by using one of the plurality of lookup tables. In an example, when the non-separable inverse transform matrix set is determined, one of Tables 11 to 13 can be selectively used.

[0650] Information specifying one of the plurality of lookup tables may be signaled in the bitstream. The information may be signaled at a sequence level, a picture level, a slice level, or a block level.

[0651] Alternatively, one of the plurality of lookup tables may be selected based on at least one of a size or a shape of the current block or a transform kernel applied in the first transform.

[0652] When an inverse transform matrix of a predefined size is used, it can be set not to use the method of determining a non-separable inverse transform matrix set based on the intra prediction mode. In an example, when an inverse transform matrix of a 48×16 size is used, the process of determining a non-separable inverse transform matrix set based on the intra prediction mode can be omitted.

[0653] As in the above-mentioned description, one of the plurality of non-separable transform matrix candidates may be applied to the current block. In this case, each of the non-separable transform matrix candidates may have at least one different size or coefficient.

[0654] Fig.39 is an example showing various non-separable transformation matrix candidates.

[0655] It is assumed that a 4×4 sub-block is a target for the second inverse transform.

[0656] As in Fig.39 In the example shown in (a), a transform matrix of 64×1 size may be derived by using a non-separable inverse transform matrix of 64×16 size. The derived transform matrix may be set as a transform coefficient of a block of 8×8 size.

[0657] As in Fig.39 In the example shown in (b), a transform matrix of 32×1 size may be derived by using a non-separable inverse transform matrix of 32×16 size. The derived transform matrix may be set as a transform coefficient of a block of 4×8 or 8×4 size.

[0658] As in Fig.39 In the example shown in (c), a transform matrix of 48×1 size can be derived by using a non-separable inverse transform matrix of 48×16 size. The derived transform matrix can be set as the transform coefficients of three 4×4 size blocks. There is a non-zero transform coefficient in the upper left block of the three 4×4 size blocks, and in other blocks, the value of the transform coefficient in the block can be set to 0.

[0659] The non-separable inverse transform matrix to be applied to the current block may be determined based on whether the sub-partition intra encoding method is applied to the current block. In an example, optionally, when the sub-partition intra encoding method is applied to the current block, a non-separable inverse transform matrix of 32×16 size may be set to be applied.

[0660] Alternatively, the type or number of non-separable inverse transform matrix candidates may be determined differently based on whether the sub-partition intra encoding method is applied to the current block. In an example, only when the sub-partition intra encoding method is applied to the current block, a non-separable inverse transform matrix of 32×16 size may be used as a candidate.

[0661] When the subpartition intra encoding method is applied to the current block and a non-separable inverse transform matrix of a 32×16 size is applied, the size or shape of a block derived by performing the second inverse transform may differ according to the size or shape of a subpartition.

[0662] In an example, when a partition in a vertical direction is applied to the current block (for example, when the sub-partition has a 4×L shape), a transform matrix of a size of 32×1 obtained by performing the second inverse transform may be set as a transform coefficient of a block of a size of 4×8. On the other hand, when a partition in a horizontal direction is applied to the current block (for example, when the sub-partition has an L×4 shape), a transform matrix of a size of 32×1 obtained by performing the second inverse transform may be set as a transform coefficient of a block of a size of 8×4.

[0663] Although the subpartition intra prediction encoding method is not applied, when the current block is encoded by intra prediction and its size is 4×L or L×4, a non-separable matrix of a size of 32×16 may be applied.

[0664] When the subpartition intra encoding method is applied to the current block, the second inverse transform and the first inverse transform may be applied to each of a plurality of subblocks included in the current block.

[0665] Optionally, the second inverse transform and the first inverse transform may be applied to a sub-block at a predefined position in the plurality of sub-blocks or a sub-block whose partition index is less than a threshold value. In an example, the second transform may be applied only to a sub-partition at the topmost position of the current block or a sub-partition at the leftmost position of the current block, and may not be applied to the remaining sub-partitions.

[0666] When the sub-partition intra-coding method is applied, the target area for the second inverse transform may be determined as 4×4 in size. Alternatively, the size of the target area may be adaptively determined according to the size of the sub-block. In an example, when the minimum value of the width and height of the sub-partition is 4, a 4×4 sized area may be set as the target area.

[0667] Alternatively, for a sub-block of a 4×N or N×4 shape, an area of ​​a 8×4 size may be set as a target area. In this case, N represents an integer equal to or greater than 8.

[0668] The input matrix may be generated by arranging the transform coefficients included in the target region in the sub-block into a row. In an example, when the target region is set to a 4×4 size, the transform coefficients included in the target region may be transformed into an input matrix of a 16×1 shape. Alternatively, when the target region is set to a 4×8 or 8×4 size, the transform coefficients included in the target region may be transformed into an input matrix of a 32×1 shape.

[0669] The transformation matrix may be derived by multiplying the input matrix by the non-separable transformation matrix. In an example, a 16×1 sized transformation matrix may be obtained by multiplying a 16×16 sized non-separable transformation matrix by a 16×1 sized input matrix. Alternatively, a 32×1 sized transformation matrix may be obtained by multiplying a 32×32 sized non-separable transformation matrix by a 32×1 sized input matrix.

[0670] When the transformation matrix is ​​obtained, the components in the transformation matrix may be set as the transformation coefficients of the sub-block. In an example, a transformation matrix of 16×1 size may be set as the transformation coefficients of a block of 4×4 size. Alternatively, a transformation matrix of 32×1 size may be set as the transformation coefficients of the upper left block of 4×8 or 8×4 size.

[0671] When the second inverse transform is applied to the subblock, a predefined transform kernel may be applied to the horizontal transform and the vertical transform of the subblock. In an example, the horizontal transform kernel and the vertical transform kernel of the subblock to which the second inverse transform is applied may be set to DCT2.

[0672] Whether the second transform is allowed may be determined based on whether the sub-transform block encoding method is applied to the coding block. In an example, when the sub-transform block encoding method is applied to the coding block, it may be set not to apply the second transform.

[0673] Optionally, when the sub-transform block encoding method is applied to the encoding block, it can be set to apply the second transform only to at least one available sub-block among the multiple sub-blocks. In this case, the available sub-block may represent a block among the multiple sub-blocks on which the first transform is performed.

[0674] The size of the target area for the second transformation in the sub-block may be determined according to the size or shape of the sub-block. In an example, when at least one of the height or width of the sub-block is less than a threshold, the second transformation may be performed for a 4×4 area. On the other hand, when at least one of the height or width of the sub-block is equal to or greater than the threshold, the second transformation may be performed for an 8×8 area.

[0675] Whether the second transform is applied to the sub-block may be determined based on at least one of the size, shape, position, or partition index of the sub-block. In an example, the second transform may be applied only to the sub-block including the upper left sample of the coding block. Optionally, the second transform may be applied only when at least one of the height or width of the sub-block is greater than a threshold.

[0676] Alternatively, information indicating whether the second transform is applied to the sub-block may be signaled in the bitstream.

[0677] When the sub-transform block coding method is applied, it may be set not to allow the down-scaling second transform. Alternatively, although the sub-transform block coding method is applied, it may be determined whether the down-scaling second transform is performed based on at least one of the size or shape of the sub-block.

[0678] The reconstructed sample of the sub-block on which the transformation is performed may be derived by the sum of the prediction sample and the residual sample. On the other hand, the prediction sample may be set to the reconstructed sample in the sub-block on which the transformation is omitted. Quantization is used to reduce the energy of the block, and the quantization process includes a process of dividing the transformation coefficient by a specific constant value. The constant value may be derived from a quantization parameter, and the quantization parameter may be defined as a value from 1 to 63.

[0679] When a reconstructed block of a current block is obtained, information loss generated in quantization and encoding processes can be reduced via in-loop filtering. The in-loop filter may include at least one of a deblocking filter, a sample adaptive offset filter (SAO), or an adaptive loop filter (ALF). Hereinafter, the reconstructed block before applying the in-loop filter is referred to as a first reconstructed block, and the reconstructed block after applying the in-loop filter is referred to as a second reconstructed block.

[0680] The second reconstructed block may be obtained by applying at least one of a deblocking filter, SAO, or ALF to the first reconstructed block. In this case, the SAO or ALF may be applied after the deblocking filter is applied.

[0681] A method of dividing a picture into a plurality of regions and encoding / decoding the plurality of regions in parallel for real-time or low-latency encoding of high-resolution images such as panoramic videos, 360-degree videos, or 4K / 8K UHD (ultra-high definition) images, etc. may be considered. Specifically, for processing purposes, the picture may be partitioned into parallel blocks or strips (or parallel block groups).

[0682] A parallel block represents a basic unit of parallel encoding / decoding. Each parallel block can be processed in parallel. A parallel block can have a rectangular shape. In another embodiment, non-rectangular parallel blocks can be allowed.

[0683] Information indicating whether non-rectangular tiles are allowed or whether non-rectangular tiles exist may be signaled in a bitstream.

[0684] When a parallel block is encoded / decoded, the data of another parallel block cannot be used. Parallel processing of parallel blocks can be supported by removing the encoding / decoding dependency between parallel blocks. Specifically, the probability table of CABAC (context adaptive binary arithmetic coding) context can be initialized in units of parallel blocks, and the in-loop filter can be set not to be applied to the boundary between parallel blocks. In addition, the data in another parallel block may not be used as a candidate for deriving motion vectors. For example, the data in another parallel block may not be used as a merge candidate, a motion vector prediction candidate (AMVP candidate) or a motion information candidate. In addition, the data in another parallel block may not be used for context calculation of symbols.

[0685] Image encoding / decoding information may be signaled through a slice header. Information signaled through a slice header may be commonly applied to tiles or coding tree units included in a slice. A slice may also be referred to as a tile group.

[0686] Fig.40 is a diagram illustrating a screen partitioning method according to an embodiment of the present disclosure.

[0687] First, it may be determined whether the current picture is partitioned into a plurality of processing units (S4001). In this case, the processing unit may include at least one of a parallel block or a slice. In an example, a syntax no_pic_partition_flag indicating whether the current picture is partitioned into a plurality of parallel blocks or slices may be signaled in a bitstream. When the value of the syntax no_pic_partition_flag is 0, this indicates that the current picture is partitioned into at least one parallel block or at least one slice. On the other hand, when the value of the syntax no_pic_partition_flag is 1, this indicates that the current picture is not partitioned into a plurality of parallel blocks or slices.

[0688] When it is determined that the current picture is not partitioned into a plurality of processing units, the partitioning process of the current picture may be terminated. In this case, it may be understood that the current picture is configured using one tile and one slice (or one tile group).

[0689] Optionally, information indicating whether there are multiple parallel blocks in the picture may be sent as a bitstream signal. The information may include at least one of a 1-bit flag indicating whether there are multiple parallel blocks in the picture or information specifying the number of parallel blocks in the picture. Only when it is determined that there are multiple parallel blocks in the picture, the picture partitioning process described later may be performed.

[0690] When it is determined that the current picture is partitioned into a plurality of processing units, tile partition information may be signaled in a bitstream.Based on the signaled tile partition information, the picture may be partitioned into at least one tile (S4002).

[0691] When the current picture is partitioned into a plurality of tiles, a slice may be determined by merging the plurality of tiles or by partitioning the tiles ( S4003 ).

[0692] Hereinafter, according to the present disclosure, a method of partitioning a tile and a method of determining a stripe are described in detail.

[0693] Fig.41 An example of partitioning a screen into a plurality of tiles is shown.

[0694] A tile may include at least one coding tree unit. A boundary of a tile may match a boundary of a coding tree unit. In other words, a partition type that partitions a single coding tree unit into multiple parts may not be allowed.

[0695] When a picture is partitioned into a plurality of tiles, heights of adjacent tiles or widths of adjacent tiles may be set to have the same value.

[0696] In the example, as in Fig.41 In the example shown in , the heights of the parallel blocks belonging to the same parallel block row and / or the widths of the parallel blocks belonging to the same parallel block column can be set to be the same. The parallel blocks belonging to the same parallel block row can be referred to as a parallel block set in the horizontal direction, and the parallel blocks belonging to the same parallel block column can be referred to as a parallel block set in the vertical direction.

[0697] Alternatively, information indicating whether the width and / or height of a tile to be encoded / decoded is the same as the width and / or height of a previous tile may be signaled.

[0698] Information indicating the partition type of a picture may be signaled in a bitstream. The information may be encoded and signaled through a picture parameter set, a sequence parameter set, or a slice header.

[0699] The information indicating the partition type of the picture may include at least one of information indicating whether the parallel blocks are partitioned in a uniform size, information indicating the number of parallel block columns, or information indicating the number of parallel block rows. In this case, the number of parallel block columns indicates the number of parallel block sets in the vertical direction, and the number of parallel block rows indicates the number of parallel block sets in the horizontal direction.

[0700] When a picture is partitioned by using at least one of a vertical line or a horizontal line across the picture, each parallel block belongs to a different column and / or row. In order to determine the partition type of the picture, information indicating the number of parallel block columns and / or the number of parallel block rows may be sent by a signal. In an example, information num_tile_row_minus1 indicating the number of parallel block rows generated by partitioning the picture and information num_tile_column_minus1 indicating the number of parallel block columns generated by partitioning the picture may be sent by a bitstream signal. The syntax num_tile_row_minus1 indicates a value obtained by subtracting 1 from the number of parallel block rows, and the syntax num_tile_column_minus1 indicates a value obtained by subtracting 1 from the number of parallel block columns.

[0701] exist Fig.41 In the example shown in , the number of tile columns is 4, and the number of tile rows is 3. Therefore, num_tile_columns_minus1 may represent 3, and num_tile_rows_minus1 may represent 2.

[0702] The syntax indicating the width of each tile column and the syntax indicating the height of each tile row may be signaled in the bitstream. In an example, tile_cols_width_minus1[i] may indicate the width of the i-th tile column, and tile_rows_height_minus1[j] may indicate the height of the j-th tile row.

[0703] The syntax tile_cols_width_minus1[i] indicates a value obtained by subtracting 1 from the number of coding tree unit columns configuring the i-th tile column. For the last tile column, the operation of signaling the syntax tile_cols_width_minus1[i] may be omitted. The width of the last tile column may be derived by subtracting the width of the previous tile column from the width of the current picture.

[0704] The syntax tile_rows_height_minus1[j] represents a value obtained by subtracting 1 from the number of coding tree unit rows configuring the j-th tile row. For the last tile row, the operation of signaling the syntax tile_rows_height_minus1[i] may be omitted. The height of the last tile row may be derived by subtracting the height of the previous tile row from the height of the current picture.

[0705] In another example, information indicating the number of parallel block columns where width information is explicitly signaled and / or information indicating the number of parallel block rows where height information is explicitly signaled may be signaled in the bitstream. Table 14 shows a syntax table including the information.

[0706]

Table 14

[0707]

[0708]

[0709]

[0710] The syntax num_exp_tile_columns_minus1 derived by subtracting 1 from the number of tile columns for which width information is explicitly signaled may be signaled in the bitstream.

[0711] When the number of tile columns for which width information is explicitly signaled is determined by syntax num_exp_tile_columns_minus1, width information tile_column_width_minus1[i] may be signaled as many as the determined number. In this case, i may have a value between 0 and num_exp_tile_columns_minus1.

[0712] The width of a tile column with index k equal to or less than num_exp_tile_columns_minus1 may be determined based on the syntax tile_column_width_minus1[k] signaled for the corresponding tile column. Specifically, the width of a tile column with index k equal to or less than num_exp_tile_columns_minus1 may be determined by multiplying a value derived by adding 1 to the value of the syntax tile_column_width_minus1[k] by the width of the coding tree unit.

[0713] On the other hand, the width of the tile column with index k greater than num_exp_tile_columns_minus1 may be determined based on the width information last signaled and the number of remaining coding tree unit columns in the picture. In an example, when the width of the tile column derived by the syntax tile_column_width_minus1[num_exp_tile_columns_minus1] associated with the last signaled width is LastColWidth (i.e., tile_column_width_minus1[num_exp_tile_columns_minus1]+1) and the number of remaining coding tree unit columns in the current picture excluding the area occupied by the previous tile column is remainingWidthInCtbY, the width of the kth tile column may be set to the smaller value between LastColWidth and remainingWidthInCtbY.

[0714] Table 15 is an example describing the process of determining the width of a tile column.

[0715]

Table 15

[0716]

[0717]

[0718] In Table 15, the variable PicWidthInCtbsY represents the total number of coding tree unit columns in a picture. In an example, the variable PicWidthInCtbsY may be derived based on the following Equation 10.

[0719] [Equation 10]

[0720] PicWidthInCtbsY=Ceil(pic_width_in_luma_samples / CtbSizeY)

[0721] In Equation 10, pic_width_in_luma_samples represents the number of luma samples in the horizontal direction in the picture. The variable CtbSizeY may be a value representing the size of the coding tree unit.

[0722] The variable remainingWidthInCtbsY may be derived by subtracting the accumulated width of the previous tile column from the variable PicWidthInCtbsY.

[0723] The syntax num_exp_tile_rows_minus1 derived by subtracting 1 from the number of tile rows for which height information is explicitly signaled may be signaled in the bitstream.

[0724] When the number of tile rows for which height information is explicitly signaled is determined by syntax num_exp_tile_rows_minus1, height information tile_row_height_minus1[i] may be signaled as many times as the determined number. In this case, i may have a value between 0 and num_exp_tile_rows_minus1.

[0725] The height of a tile row with index k equal to or less than num_exp_tile_rows_minus1 may be determined based on the syntax tile_row_Height_minus1[k] signaled for the corresponding tile row. Specifically, the height of a tile row with index k equal to or less than num_exp_tile_rows_minus1 may be determined by multiplying a value derived by adding 1 to the value of the syntax tile_row_Height_minus1[k] by the height of the coding tree unit.

[0726] On the other hand, the height of the tile row with index k greater than num_exp_tile_rows_minus1 may be determined based on the height information last signaled and the number of remaining coding tree unit rows in the picture. In an example, when the height of the tile row derived by the syntax tile_row_height_minus1[num_exp_tile_rows_minus1] associated with the height information last signaled is LastRowHeight (i.e., tile_row_height_minus1[num_exp_tile_rows_minus1]+1) and the number of remaining coding tree unit rows in the current picture excluding the area occupied by the previous tile row is remainingHeightInCtbsY, the height of the kth tile row may be set to the smaller value of LastColHeight and remainingHeightInCtbsY.

[0727] Table 16 is an example describing the process of determining the height of a tile row.

[0728]

Table 16

[0729]

[0730] In Table 16, the variable PicHeightInCtbsY represents the total number of coding tree unit rows in the picture. In an example, the variable PicHeightInCtbsY may be derived based on the following Equation 11.

[0731] [Equation 11]

[0732] PicHeightInCtbsY=Ceil(pic_height_in_lima_samples / CtbSizeY)

[0733] In Equation 11, pic_height_in_luma_samples represents the number of luma samples in the vertical direction in the picture. The variable CtbSizeY may be a value representing the size of the coding tree unit.

[0734] The variable remainingheightInCtbsY may be derived by subtracting the accumulated height of the previous tile rows from the variable PicHeightInCtbsY.

[0735] By Fig.41 As an example, each of the four parallel block columns is described as being configured using two coding tree unit columns. Therefore, for only the first parallel block column, the syntax tile_column_width_minus1[0] may be signaled as a value of 1, and the widths of the remaining parallel block columns may be set to be the same as tile_column_width_minus1[0]. Since the number of syntax tile_column_width_minus1 to be signaled is 1, the value of the syntax num_exp_tile_columns_minus1 may be set to 0.

[0736] exist Fig.41 , the first parallel block row is configured using 3 coding tree unit rows, and the second and third parallel block rows are configured using 2 coding tree unit rows. Since the height of the third parallel block row can be derived based on the height information of the second parallel block row, the height information can be signaled only for the first and second parallel block rows. In the example, the syntax tile_row_height_minus1[0] for the first parallel block row can be signaled as a value of 2, and the syntax tile_row_height_minus1[1] for the second parallel block row can be signaled as a value of 1. Since the number of syntax tile_row_width_minus1 to be signaled is 2, the value of the syntax num_exp_tile_rows_minus1 can be set to 1.

[0737] On the other hand, information indicating the size of the coding tree unit may be signaled through a sequence parameter set or a picture parameter set.

[0738] One tile may be configured using at least one coding tree unit. The remaining tiles except for the tile adjacent to the right boundary or the bottom boundary of the picture may be set not to be configured by including an area smaller than the coding tree unit. In other words, the boundary of the tile matches the boundary of the coding tree unit.

[0739] The syntax loop_filter_across_tiles_enabled_flag indicates whether it is allowed to apply an in-loop filter to the boundary of a tile in a picture of a reference picture parameter set. In this case, the in-loop filter may include at least one of a deblocking filter, an ALF, or a SAO. When the value of the flag loop_filter_across_tiles_enabled_flag is 1, this indicates that an in-loop filter across the boundary of a tile in a picture of a reference picture parameter set may be applied. On the other hand, when the value of the flag loop_filter_across_tiles_enabled_flag is 0, this indicates that it is not allowed to apply an in-loop filter to the boundary of a tile in a picture of a reference picture parameter set.

[0740] The syntax loop_filter_across_slices_enabled_flag indicates whether it is allowed to apply an in-loop filter to the boundary of a slice in a picture of a reference picture parameter set. In this case, the in-loop filter may include at least one of a deblocking filter, an ALF, or a SAO. When the value of the flag loop_filter_across_slices_enabled_flag is 1, this indicates that an in-loop filter across the boundary of a slice in a picture of a reference picture parameter set may be applied. On the other hand, when the value of the flag loop_filter_across_slices_enabled_flag is 0, this indicates that it is not allowed to apply an in-loop filter to the boundary of a slice in a picture of a reference picture parameter set.

[0741] Table 17 shows a syntax table including a flag no_pic_partition_flag indicating whether a picture is partitioned into a plurality of regions.

[0742]

Table 17

[0743]

[0744] When the flag no_pic_partition_flag is 1, this indicates that a picture or a sub-picture is not partitioned into a plurality of tiles or a plurality of slices. When the value of the flag no_pic_partition_flag is 1, encoding of syntax related to a tile partition structure and / or a slice partition structure may be omitted.

[0745] On the other hand, when no_pic_partition_flag is 0, this indicates that a picture or a sub-picture can be partitioned into a plurality of tiles or a plurality of slices. When the value of the flag no_pic_partition_flag is 0, the syntax pps_log2_ctu_size_minus5 for determining the size of the coding tree unit may be signaled.

[0746] A rectangular area configured with multiple coding tree units may be defined as a parallel block. In other words, a single coding tree unit may not be defined as a parallel block. As described above, when multiple coding tree units are defined as parallel blocks, the range of the value of the syntax tile_row_height_minus1 may be determined according to the value of the syntax tile_column_width_minus1, or the range of the value of the syntax tile_column_width_minus1 may be determined according to the value of the syntax tile_row_height_minus1.

[0747] In the example, when the value of the syntax tile_column_width_minus1 is 0, this indicates that one coding tree unit column is included in the tile. As described above, since one tile is configured using a plurality of coding tree units, tile_row_height_minus1 indicating the height of the tile should have a value greater than 0. In other words, when the syntax tile_column_width_minus1 is encoded and signaled before the syntax tile_row_height_minus1, and if the value of the syntax tile_column_width_minus1 is 0, the syntax tile_row_height_minus1 may have a value equal to or greater than 1.

[0748] On the other hand, when the syntax tile_row_height_minus1 is encoded and signaled before the syntax tile_column_width_minus1, and if the value of the syntax tile_row_height_minus1 is 0, the syntax tile_column_width_minus1 may have a value equal to or greater than 1.

[0749] As in the example, when a tile is configured using one coding tree unit column, the tile should include multiple coding tree rows. In other words, when the value of the syntax tile_column_width_minus1[i] indicating the width of the i-th tile is 0, the value of the syntax tile_row_height_minus1[i] indicating the height of the i-th tile should be equal to or greater than 1.

[0750] In addition, when a tile is configured using one coding tree unit row, the tile should include multiple coding tree columns. In other words, when the value of the syntax tile_row_height_minus1[i] indicating the height of the i-th tile is 0, the value of the syntax tile_row_width_minus1[i] indicating the width of the i-th tile should be equal to or greater than 1.

[0751] Therefore, when the syntax tile_column_width_minus1[i] is encoded before the syntax tile_row_height_minus1[i], each syntax may be defined as in Table 18 below.

[0752]

Table 18

[0753]

[0754] Conversely, when the syntax tile_row_height_minus1[i] is encoded before the syntax tile_column_width_minus1[i], each syntax may be defined as in Table 19 below.

[0755]

Table 19

[0756]

[0757]

[0758] In another example, when the value of the syntax tile_column_width_minus1[i] is 0, the syntax tile_row_height_minus2[i] may be encoded instead of the syntax tile_row_height_minus1[i]. The syntax tile_row_height_minus2[i] may be derived by subtracting 2 from the number of coding tree unit rows included in the i-th tile.

[0759] Alternatively, when the value of the syntax tile_row_height_minus1[i] is 0, the syntax tile_column_width_minus2[i] may be encoded instead of the syntax tile_column_width_minus1[i]. The syntax tile_column_width_minus2[i] may be derived by subtracting 2 from the number of coding tree unit columns included in the i-th tile.

[0760] At least one or more parallel blocks may be defined as a processing unit. In an example, multiple parallel blocks may be defined as a stripe. A stripe may be referred to as a parallel block group.

[0761] Optionally, a parallel block may be partitioned into a plurality of processing units. In an example, a parallel block may be partitioned into a plurality of slices. In this case, a slice may include at least one coding tree unit column. When a parallel block is partitioned into a plurality of slices, information indicating the height of each slice may be signaled in a bitstream.

[0762] At least one of the four sides of the configuration strip may match the border of the picture and / or the border of the tile. In an example, the left border or the top border of the strip may be set to match the left border or the top border of the picture. Optionally, at least one of the four sides of the strip may be located at the border of the tile.

[0763] Image encoding / decoding information may be signaled through a slice header. Information signaled through a slice header may be commonly applied to tiles and / or blocks belonging to a slice.

[0764] Information indicating the slice type may be signaled in a bitstream. The information indicates a definition method of slices in a current picture. In an example, a syntax rect_slice_flag indicating the slice type may be signaled in a bitstream.

[0765] The syntax rect_slice_flag indicates whether the slice is defined based on the raster scan order of the tile or whether the slice is defined in a rectangular shape. In the example, when rect_slice_flag is 0, this indicates that the slice is defined based on the raster scan order of the tile. On the other hand, when rect_slice_flag is 1, this indicates that the slice is defined in a rectangular shape.

[0766] In the following, two methods for determining the bands are described in detail.

[0767] The raster scan based definition method specifies at least one or more parallel blocks according to a raster scan order and defines at least one or more specified parallel blocks as strips. When the raster scan based definition method is applied, one or more continuous parallel blocks may be defined as strips. In this case, continuous parallel blocks may be determined according to a raster scan order. When raster scan strips are applied, non-rectangular strips may be generated.

[0768] When the slices are defined based on the raster scan order, information indicating the number of tiles included in each slice may be signaled. For the last slice, the operation of signaling the number of tiles included in the slice may be omitted.

[0769] When a slice includes a plurality of tiles, widths or heights of the tiles included in the slice may be different.

[0770] The method for defining a stripe of a rectangular shape is a partitioning method that allows only stripes of a rectangular shape. When the method for defining a stripe of a rectangular shape is applied, tiles located at four corners of the stripe belong to the same row or column.

[0771] Alternatively, when a method for defining a rectangular-shaped strip is applied, one tile may be partitioned into a plurality of rectangular strips.

[0772] When the definition method of a rectangular-shaped slice is applied (for example, when rect_slice_flag is 1), information indicating whether a picture is configured using a single slice may be signaled. In an example, a syntax one_slice_in_pic_flag indicating whether the number of slices in a picture is 1 may be signaled in a bitstream. When the flag one_slice_in_pic_flag is 1, this indicates that the picture is configured using a single slice. On the other hand, when the flag one_slice_in_pic_flag is 0, this indicates that the picture is configured using at least two or more slices.

[0773] Optionally, information indicating whether each sub-picture is configured using one slice may be sent by a signal. In an example, a flag single_slice_per_subpic indicating whether each sub-picture is configured using a single slice may be sent by a signal. When the flag single_slice_per_subpic is 1, this indicates that each sub-picture is configured using a single slice. In this case, it may be determined that the slice partition structure is the same as the sub-picture partition structure determined by the reference sequence parameter set. On the other hand, when single_slice_per_subpic is 0, this indicates that the sub-picture partition structure is different from the slice partition structure. When the value of the flag single_slice_per_subpic is 0, information for determining the slice partition structure may be sent by a signal in addition.

[0774] The size of the slice may be determined based on the number of parallel block columns and / or the number of parallel block rows included in the slice. The syntax slice_height_in_tiles_minus1[i] that indicates the height of the i-th slice may be signaled in the bitstream is described with reference to Table 14. The syntax slice_height_in_tiles_minus1[i] indicates a value obtained by subtracting 1 from the number of parallel block rows included in the i-th slice. In this case, the height of the i-th slice may be derived by adding the height of each parallel block row included in the i-th slice.

[0775] The syntax slice_width_in_tiles_minus1[i] indicating the width of the i-th slice may be signaled in the bitstream. The syntax slice_width_in_tiles_minus1[i] indicates a value obtained by subtracting 1 from the number of tile columns included in the i-th slice. In this case, the width of the i-th slice may be derived by adding the width of each tile column included in the i-th slice.

[0776] Fig.42 is a diagram for describing an aspect of signaling size information of a slice.

[0777] exist Fig.42 In the example shown in , a slice with index 4 (slice 4) is configured with 2 tile columns and 2 tile rows. Therefore, the syntax slice_width_in_tiles_minus1[4] indicating the width of the slice and the syntax slice_height_in_tiles_minus1[4] indicating the height of the slice for slice 4 may be set to 1 respectively.

[0778] One tile may be partitioned into a plurality of stripes. In an example, one tile may be partitioned into a plurality of stripes by using at least one vertical line.

[0779] When one tile is partitioned into a plurality of slices, width information and height information for the i-th slice may be respectively set to 0. In an example, when both the syntax slice_width_in_tiles_minus1[i] indicating the width of the i-th slice and the syntax slice_height_in_tiles_minus1[i] indicating the height of the i-th slice are 0, the syntax num_slices_in_tiles_minus1[i] indicating the number of slices included in the corresponding tile may be signaled. The syntax num_slices_in_tiles_minus1[i] indicates a value obtained by subtracting 1 from the number of slices included in the tile.

[0780] When the value of the syntax num_slices_in_tiles_minus1[i] is 0, this indicates that the i-th slice is configured using one tile. On the other hand, when the value of the syntax num_slices_in_tiles_minus1[i] is greater than 0, this indicates that the tile including the i-th slice is partitioned into a plurality of slices. When the value of the syntax num_slices_in_tiles_minus1[i] is greater than 0, information indicating the height of each tile may be additionally signaled.

[0781] In an example, the syntax slice_height_in_ctu_minus1[i][j] may be derived by subtracting 1 from the number of coding tree unit rows included in the j-th slice in the corresponding tile. For the last slice in the corresponding tile, the encoding of the syntax slice_height_in_ctu_minus1 may be omitted. The height of the last slice may be determined based on the heights of the remaining coding tree unit rows in the tile.

[0782] Information identifying tiles included in each slice may be transmitted by a signal.

[0783] Specifically, difference information for specifying the index of a tile included in a slice may be encoded and signaled. In an example, a syntax tile_idx_delta[i] representing a value minus the index of a tile at a predetermined position in the (i+1)th slice and the index of a tile at a predetermined position in the i-th slice may be encoded. In this case, the tile at the predetermined position may be an upper left tile or a lower right tile in the slice.

[0784] For the last slice, the encoding of the difference information may be omitted.

[0785] Using the difference information, information indicating the sign of the difference information may also be encoded and signaled. In an example, the syntax tile_idx_delta_sign[i] indicating whether the value of the syntax tile_idx_delta[i] is positive or negative may be signaled in the bitstream. In this case, since the difference between the first slice (i.e., the slice where i is 0) and the second slice (i.e., the slice where i is 1) is always positive, encoding of the syntax tile_idx_delta_sign[i] may be omitted for the first slice.

[0786] When the i-th slice and the (i+1)-th slice are not included in one tile, the absolute value of the tile block index difference between the i-th slice and the (i+1)-th slice always has a value greater than 1. Therefore, the syntax tile_idx_delta_minus1[i] derived by subtracting 1 from the absolute value of the tile block index difference between the i-th slice and the (i+1)-th slice may be encoded and signaled.

[0787] Table 20 shows a syntax table including difference information.

[0788]

Table 20

[0789]

[0790]

[0791]

[0792] When one tile includes a plurality of slices, the plurality of slices are included in the same tile, and thus the tile block index difference value between the plurality of slices becomes 0. Therefore, encoding of the difference value between the plurality of slices included in one tile may be omitted. Since encoding of the difference information between the slices belonging to the same tile is omitted, the syntax tile_idx_delta_minus1[i] may always be set to a value equal to or greater than 0.

[0793] In addition, when one tile includes a plurality of slices, difference information may be encoded for only one of the plurality of slices. In an example, the syntax tile_idx_delta_minus1[i] may be encoded for only the first slice or the last slice of the plurality of slices included in one tile. In an example, the i-th slice specified by the syntax tile_idx_delta_minus1[i] represents the first slice or the last slice of the plurality of slices belonging to the first tile, and the (i+1)-th slice represents a slice belonging to a second tile different from the first tile.

[0794] The syntax tile_idx_delta_sign[i] represents the sign of the tile index difference value. In an example, the sign of the tile index difference value TileIdxDeltaSign may be determined as in the following equation 12.

[0795] [Equation 12]

[0796] TileIdxeltaSign[i]=tile_idx_delta_sign[i]? 1:-1

[0797] As shown in Equation 12, when the value of the syntax tile_idx_delta_sign[i] is 1, this indicates that the tile index difference derived from the syntax tile_idx_delta_minus1[i] is positive. When the value of the syntax tile_idx_delta_sign[i] is 0, this indicates that the tile index difference derived from the syntax tile_idx_delta_minus1[i] is negative.

[0798] The tile block index difference may be derived by multiplying the tile block index difference value derived from the syntax tile_idx_delta_minus1[i] (eg, tile_idx_delta_minus1[i]+1) by the sign value derived from the syntax tile_idx_delta_sign[i].

[0799] For at least one of the first slice (e.g., a slice where i is 0), the last slice (e.g., a slice where i is num_slices_in_pic_minus1), or the slice before the last slice (e.g., a slice where i is num_slices_in_pic_minus1-1), the encoding of the syntax tile_idx_delta_sign[i] may be omitted. When encoding of the syntax tile_idx_delta_sign[i] is omitted, the value may be inferred to be 1.

[0800] Optionally, encoding of sign information of the parallel block index difference value may be omitted, and the parallel block index difference value may be set to always have a positive value.

[0801] Based on the position of the slice, it can be determined whether the parallel block index difference information is encoded. Table 21 shows an example of determining whether the parallel block index difference information is parsed based on the position of the slice.

[0802]

Table 21

[0803]

[0804]

[0805] In Table 21, the variable tileIdx represents the index of the top left tile in the i-th stripe.

[0806] When the top left tile included in the i-th slice belongs to the last tile row in the picture, encoding / decoding of the syntax tile_idx_delta_minus1[i] indicating the tile index difference may be omitted. In other words, the syntax tile_idx_delta_minus1[i] may be encoded only when the top left tile of the i-th slice does not belong to the last tile row in the picture.

[0807] When encoding of the syntax tile_idx_delta_minus1[i] is omitted, the value of the syntax tile_idx_delta_minus1[i] may be inferred to be the same as the value of the syntax slice_width_in_tiles_minus1[i].

[0808] When the upper left tile included in the i-th slice belongs to the last tile column in the picture, or when the upper left tile included in the i-th slice belongs to the last tile row in the picture, encoding / decoding of the syntax tile_idx_delta_sign[i] representing the sign of the tile index difference can be omitted.

[0809] When encoding of the syntax tile_idx_delta_sign[i] is omitted, the value of the syntax tile_idx_delta_sign[i] may be inferred to be 1.

[0810] In the above example, it is shown that when the tile to which the i-th slice belongs includes a plurality of slices, information indicating the number of slices belonging to the tile and height information of each of the slices are signaled.

[0811] In another example, when the tile to which the i-th slice belongs includes a plurality of slices, the number information of the slices for which the height information is explicitly signaled may be signaled, and the height information may be signaled as much as the number specified by the number information. Table 22 shows a syntax table including the number information for which the height information should be explicitly signaled.

[0812]

Table 22

[0813]

[0814]

[0815] In Table 22, the syntax exp_num_slices_in_tile_minus1[i] represents the number of slices for which height information is explicitly signaled in a tile including the i-th slice. Specifically, the syntax exp_num_slices_in_tile_minus1[i] may be derived by subtracting 1 from the number of slices for which height information is explicitly signaled.

[0816] The variable numExpSlicesI...

Claims

1. A method for decoding a video, the method comprising: Partitioning the current picture into a plurality of parallel blocks, wherein the current picture is partitioned into a plurality of parallel block columns and a plurality of parallel block rows; Determine whether the rectangular strip mode is applied to the current picture; When the rectangular slice mode is applied to the current picture, decoding the slice number information from the bitstream; Decoding width information of a first slice from a bitstream, the width information indicating a value obtained by subtracting 1 from the number of tile columns included in the first slice; decoding first height information of a first slice from a bitstream, the first height information indicating a value obtained by subtracting 1 from the number of tile rows included in the first slice, When both the width information and the first height information are equal to 0, the first stripe is the same as the tile including the first stripe, or is one of the multiple stripes included in the tile. wherein, when the width information and the first height information are both equal to 0, explicit quantity information is additionally decoded from the bitstream, wherein the explicit quantity information indicates the number of stripes in which the second height information is explicitly signaled, When the explicit quantity information is 0, the first stripe is the same as the parallel block, and the second height information is not parsed for the first stripe. Among them, when the explicit quantity information is greater than 0, the height of the first slice is determined to be equal to or less than the height of the parallel block based on the second height information parsed for the first slice, and the second height information parsed for the first slice indicates the value obtained by subtracting 1 from the number of coding tree unit CTU rows included in the first slice.

2. The method of claim 1, wherein: Whether to parse the second height information for a second slice is determined by comparing an index of the second slice among the plurality of slices in the tile with the explicit quantity information.

3. The method of claim 2, wherein: When it is determined that the second height information is parsed for the second stripe, deriving the height of the second stripe based on the second height information parsed for the second stripe, When it is determined that the second height information is not to be parsed for the second stripe, the height of the second stripe is derived based on the second height information last parsed for another stripe in the tile.

4. The method of claim 2, wherein: When the index of the second stripe is less than the explicit quantity information, parsing the second height information for the second stripe, When the index of the second stripe is equal to or greater than the explicit quantity information, the second height information is not parsed for the second stripe.

5. The method of claim 1, wherein: After parsing the width information and the first height information for a first stripe with a first index, further parsing the width information and the first height information for a second stripe with a second index, Wherein, when the first stripe is one of the plurality of stripes in the parallel block, the second index is greater than the first index by the number of the plurality of stripes in the parallel block, When the tile including the first slice is not partitioned into the plurality of slices, the second index is greater than the first index by 1.

6. A method for encoding a video, the method comprising: Partitioning the current picture into a plurality of parallel blocks, wherein the current picture is partitioned into a plurality of parallel block columns and a plurality of parallel block rows; Encodes information on whether the rectangular strip mode is applied to the current picture; When the rectangular stripe mode is applied to the current picture, the stripe number information is encoded into the bitstream; Encoding width information of the first slice into a bit stream, the width information indicating a value obtained by subtracting 1 from the number of tile columns included in the first slice; encoding first height information of the first slice into a bitstream, the first height information indicating a value obtained by subtracting 1 from the number of tile rows included in the first slice, wherein in response to the height of the first slice being equal to or less than the first tile, the first height information is encoded as a value of 0; and Determines whether to additionally encode explicit quantity information into the bitstream, When the first slice is the same as the tile including the first slice or is one of the plurality of slices included in the tile, the width information and the first height information are encoded as 0, Wherein, when the width information and the first height information are both 0, the explicit quantity information is additionally encoded into the bitstream, the explicit quantity information indicating the number of slices in which the second height information is explicitly signaled, Wherein, when the explicit quantity information is encoded as a value of 0, the first stripe is the same as the parallel block, wherein, when the first slice is one of the plurality of slices in the tile, the explicit quantity information is encoded as a value greater than 0, The second height information for the first slice is encoded as a value obtained by subtracting 1 from the number of coding tree unit CTU rows included in the first slice.

7. The method of claim 6, wherein: When the index of the second slice in the tile is less than the explicit quantity information, encoding the second height information for the second slice, When the index of the second slice in the tile is equal to or greater than the explicit quantity information, the second height information is not encoded for the second slice.

8. The method of claim 7, wherein: When the second height information is not encoded for the second slice, the height of the second slice is a minimum value among the height of another slice for which the second height information is last encoded and a remaining height outside an area occupied by a previous slice in the tile.

9. An apparatus for transmitting compressed video data, the apparatus comprising: a processor configured to obtain the compressed video data, and a sending unit, configured to send the compressed video data, The operation of obtaining the compressed video data includes: Partitioning the current picture into a plurality of parallel blocks, wherein the current picture is partitioned into a plurality of parallel block columns and a plurality of parallel block rows; Encodes information on whether the rectangular strip mode is applied to the current picture; When the rectangular stripe mode is applied to the current picture, the stripe number information is encoded into the bitstream; Encoding width information of the first slice into a bit stream, the width information indicating a value obtained by subtracting 1 from the number of tile columns included in the first slice; encoding first height information of the first slice into a bitstream, the first height information indicating a value obtained by subtracting 1 from the number of tile rows included in the first slice, wherein in response to the height of the first slice being equal to or less than the first tile, the first height information is encoded as a value of 0; and Determines whether to additionally encode explicit quantity information into the bitstream, When the first slice is the same as the tile including the first slice or is one of the plurality of slices included in the tile, the width information and the first height information are encoded as 0, Wherein, when the width information and the first height information are both 0, the explicit quantity information is additionally encoded into the bitstream, the explicit quantity information indicating the number of slices in which the second height information is explicitly signaled, Wherein, when the explicit quantity information is encoded as a value of 0, the first stripe is the same as the parallel block, wherein, when the first slice is one of the plurality of slices in the tile, the explicit quantity information is encoded as a value greater than 0, The second height information for the first slice is encoded as a value obtained by subtracting 1 from the number of coding tree unit CTU rows included in the first slice.