Video encoding / decoding method using error-resilient in-loop filter and signaling method relating to the same

KR103018545B1Active Publication Date: 2026-09-11ELECTRONICS & TELECOMM RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
KR1020240139314
Authority / Receiving Office
KR · KR
Patent Type
Patents
Current Assignee / Owner
Priority Date
2012-04-16
Filing Date
2024-10-14
Publication Date
2026-09-11
Estimated Expiration
2042-09-14

Smart Images

  • Figure 112024111141188-PAT00067_ABST
    Figure 112024111141188-PAT00067_ABST
Patent Text Reader

Abstract

The present invention relates to an image encoding / decoding method, and more specifically, to a method for performing error-robust in-loop filtering and a signaling method for the same. According to one embodiment of the present invention, an image decoding method is provided comprising the steps of: determining whether to use a Constrained Intra Prediction (CIP) mode; determining decoding parameters of blocks located on both sides of a filtering target boundary; and determining whether to apply an in-loop filter to samples located on both sides of a filtering target boundary based on whether to use the Constrained Intra Prediction mode and the decoding parameters of blocks located on both sides of the filtering target boundary.
Need to check novelty before this filing date? Find Prior Art

Description

Technology Field

[0001] The present invention relates to an image encoding / decoding method, and more specifically, to a method for performing error-robust in-loop filtering and a signaling method for the same. Background Technology

[0003] Recently, as broadcasting systems supporting HD (High Definition) resolution have expanded not only domestically but also globally, many users are becoming accustomed to high-resolution, high-quality video, and accordingly, many institutions are accelerating the development of next-generation video devices. In addition, as interest in UHD (Ultra High Definition), which supports more than four times the resolution of HDTV, grows alongside HDTV, there is a growing demand for compression technologies for even higher resolution and high-quality video.

[0004] For image compression, inter prediction techniques that predict pixel values ​​in the current picture from preceding and / or subsequent pictures, intra prediction techniques that predict pixel values ​​using pixel information within the picture, and entropy coding techniques that assign short codes to symbols with high frequency and long codes to symbols with low frequency may be used. The problem to be solved

[0006] The objective of the present invention is to provide an image encoding / decoding method and apparatus using error-robust in-loop filtering.

[0007] Another objective of the present invention is to provide a method for performing in-loop filtering based on whether to use a Constrained Intra Prediction (CIP) mode and the encoding parameters of blocks located on both sides of the filtering target boundary. means of solving the problem

[0009] [1] According to one embodiment of the present invention, an image encoding method is provided. The image encoding method includes the steps of determining whether to use a Constrained Intra Prediction (CIP) mode, determining encoding parameters of blocks located on both sides of a filtering target boundary, and determining whether to apply an in-loop filter to samples located on both sides of a filtering target boundary based on whether to use the Constrained Intra Prediction mode and the encoding parameters.

[0010] [2] In [1], the in-loop filter can be a deblocking filter.

[0011] [3] In [2], if the encoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are all blocks encoded in inter-prediction mode, then the deblocking filter may not be applied to the samples located on both sides of the filtering boundary.

[0012] [4] In [2], if the encoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are encoded in intra-prediction mode and inter-prediction mode, respectively, then the deblocking filter may not be applied to the samples belonging to the blocks encoded in intra-prediction mode among the samples located on both sides of the filtering target boundary, and the deblocking filter may be applied to the samples belonging to the blocks encoded in inter-prediction mode among the samples located on both sides of the filtering target boundary.

[0013] [5] In [2], if the encoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are blocks encoded in intra-prediction mode and inter-prediction mode, respectively, then the deblocking filter may not be applied to the samples located on both sides of the filtering boundary.

[0014] [6] According to another embodiment of the present invention, an image decoding method is provided. The image decoding method includes the steps of determining whether to use a Constrained Intra Prediction (CIP) mode, determining decoding parameters of blocks located on both sides of a filtering target boundary, and determining whether to apply an in-loop filter to samples located on both sides of a filtering target boundary based on whether to use the Constrained Intra Prediction mode and the decoding parameters of blocks located on both sides of the filtering target boundary.

[0015] [7] In [6], the in-loop filter can be a deblocking filter.

[0017] *

[0018] *[8] In [7], if the decoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are blocks decoded in intra-prediction mode, a deblocking filter can be applied to the samples located on both sides of the filtering boundary.

[0019] [9] In [7], if the decoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are all blocks decoded in inter-prediction mode, then the deblocking filter may not be applied to the samples located on both sides of the filtering boundary.

[0020]

[10] In [7], if the decoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are blocks decoded in an inter-prediction mode, a deblocking filter can be applied to the samples located on both sides of the filtering boundary.

[0021]

[11] In [7], if the decoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are blocks decoded in intra-prediction mode and inter-prediction mode, respectively, then the deblocking filter may not be applied to the samples belonging to the blocks decoded in intra-prediction mode among the samples located on both sides of the filtering boundary, and the deblocking filter may be applied to the samples belonging to the blocks decoded in inter-prediction mode among the samples located on both sides of the filtering boundary.

[0022]

[12] [7] In cases where the decoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are blocks decoded in intra-prediction mode and inter-prediction mode, respectively, the deblocking filter may not be applied to the samples located on both sides of the filtering boundary.

[0023]

[13] According to another embodiment of the present invention, an image decoding method is provided. The image decoding method includes the steps of: parsing an indicator indicating whether a restricted deblocking filter is used; determining decoding parameters of blocks located on both sides of a filtering target boundary; and determining whether to apply a deblocking filter to samples located on both sides of a filtering target boundary based on the indicator indicating whether a restricted deblocking filter is used and the decoding parameters of blocks located on both sides of the filtering target boundary.

[0024]

[14] In

[13] , if the decoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks decoded in intra-prediction mode and inter-prediction mode, respectively, then the deblocking filter may not be applied to the samples belonging to the blocks decoded in intra-prediction mode among the samples located on both sides of the filtering target boundary, and the deblocking filter may be applied to the samples belonging to the blocks decoded in inter-prediction mode among the samples located on both sides of the filtering target boundary.

[0025]

[15] In

[13] , if the decoding parameters of the blocks located on both sides of the filtering boundary indicate that the blocks located on both sides of the filtering boundary are blocks decoded in intra-prediction mode and inter-prediction mode, respectively, then the deblocking filter may not be applied to the samples located on both sides of the filtering boundary. Effects of the invention

[0027] According to the present invention, error-robust in-loop filtering can be performed.

[0028] According to the present invention, even when a region encoded in an inter-prediction mode cannot be restored normally, a block encoded in an intra-prediction mode can be decoded normally.

[0029] According to the present invention, the restoration result of a region encoded in an intra-prediction mode can be maintained to be the same in the encoder and the decoder. Brief explanation of the drawing

[0031] Figure 1 is a block diagram showing an example of the structure of an image encoder. Figure 2 is a block diagram showing an example of the structure of an image decoder. FIG. 3 is a flowchart illustrating an in-loop filtering method (encoding) according to one embodiment of the present invention. Figure 4 is a conceptual diagram illustrating an example of a limited intra-prediction being performed. Figure 5 is a flowchart illustrating a method for performing in-loop filtering on a block encoded in a limited intra-prediction mode. Figure 6 shows an example in which blocks located on both sides of the filtering target boundary are encoded in an intra-prediction mode. Figure 7 shows an example in which blocks located on both sides of the filtering target boundary are encoded in an inter-prediction mode. FIGS. 8 and 9 show an example in which blocks located on both sides of the filtering target boundary are encoded in an intra-prediction mode and an inter-prediction mode, respectively. FIG. 10 is a flowchart illustrating a method for performing deblocking filtering based on whether CIP mode and PCM mode are used and the encoding parameters of blocks located on both sides of the filtering target boundary. FIG. 11 is a flowchart illustrating an in-loop filtering method (decoding) according to one embodiment of the present invention. FIG. 12 is a flowchart illustrating an image encoding method according to one embodiment of the present invention. FIG. 13 is a flowchart illustrating an image decoding method according to an embodiment of the present invention. Specific details for implementing the invention

[0032] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. However, in describing the embodiments of the present invention, if it is determined that a detailed description of known configurations or functions may obscure the essence of the present invention, such detailed description will be omitted.

[0033] Where it is described that a component is "connected" or "joined" to another component, it may be directly connected or joined to the other component, or another component may exist in between. Furthermore, where it is described in the present invention that a specific component is "included," this does not mean that components other than the said component are excluded, but rather that additional components may be included within the scope of the embodiments or technical concept of the present invention.

[0034] Terms such as "first," "second," etc., may be used to describe various components, but said components are not limited by said terms. That is, said terms are used only for the purpose of distinguishing one component from another. Accordingly, the first component may be named the second component, and likewise, the second component may be named the first component.

[0035] Furthermore, the components shown in the embodiments of the present invention are depicted independently merely to indicate that they perform different characteristic functions, and this does not imply that each component cannot be implemented as a single piece of hardware or software. That is, each component is distinguished for convenience of explanation, and multiple components may be combined to operate as a single component, or a single component may be divided into multiple components to operate, and this is included within the scope of the rights of the present invention as long as it does not deviate from the essence of the present invention.

[0036] In addition, some components may be optional components for performance enhancement rather than essential components that perform the essential functions of the present invention. The present invention may also be implemented with a structure including only essential components, excluding optional components, and a structure including only essential components is also included within the scope of the rights of the present invention.

[0037] Figure 1 is a block diagram showing an example of the structure of an image encoder.

[0038] The video encoder (100) includes a motion prediction unit (111), a motion compensation unit (112), an intra prediction unit (120), a switch (115), a subtractor (125), a converter (130), a quantizer (140), an entropy encoding unit (150), an inverse quantizer (160), an inverse converter (170), an adder (175), a filter unit (180), and a reference picture buffer (190).

[0039] The video encoder (100) encodes the input video in an intra prediction mode or an inter prediction mode and outputs a bitstream. Intra prediction refers to prediction within a frame, and inter prediction refers to prediction between frames. The video encoder (100) transitions between the intra prediction mode and the inter prediction mode by switching the switch (115). The video encoder (100) generates a prediction block for the input block of the input video, and then encodes the residual between the input block and the prediction block.

[0040] In the case of the intra prediction mode, the intra prediction unit (120) generates a prediction block by performing spatial prediction using the pixel values ​​of already encoded blocks around the target block to be encoded.

[0041] In the case of the inter-prediction mode, the motion prediction unit (111) finds the reference block that best matches the input block within the reference picture stored in the reference picture buffer (190) and obtains a motion vector. The motion compensation unit (112) performs motion compensation using the motion vector and generates a prediction block. Here, the motion vector is a two-dimensional vector used for inter-prediction and represents the offset between the target block of the current encoding / decoding and the reference block.

[0042] The subtractor (125) generates a residual block based on the difference between the input block and the prediction block, and the transform unit (130) transforms the residual block to output a transform coefficient. The quantization unit (140) quantizes the transform coefficient to output a quantized coefficient.

[0043] The entropy encoding unit (150) performs entropy encoding based on information obtained during the encoding / quantization process and outputs a bitstream. Entropy encoding reduces the size of the bit sequence for the symbols to be encoded by representing frequently occurring symbols with a small number of bits. Therefore, an improvement in the compression performance of the image can be expected through entropy encoding. The entropy encoding unit (150) may use encoding methods such as exponential golomb and CABAC (Context-Adaptive Binary Arithmetic Coding) for entropy encoding.

[0044] Meanwhile, the encoded picture needs to be decoded and stored again to be used as a reference picture for performing inter-prediction. Accordingly, the inverse quantization unit (160) inversely quantizes the quantized coefficients, and the inverse transformation unit (170) inversely transforms the inversely quantized coefficients to output a restored difference block. The adder (175) adds the restored difference block to the prediction block to generate a restored block.

[0045] The filter unit (180) is also called an adaptive in-loop filter and performs at least one of deblocking filtering, SAO (Sample Adaptive Offset) compensation, and ALF (Adaptive Loop Filtering) on ​​the restored block. Deblocking filtering means removing block distortion that occurs at the boundaries between blocks, and SAO compensation means adding an appropriate offset to the pixel value to compensate for coding errors. Additionally, ALF means performing filtering based on a value obtained by comparing the restored image with the original image.

[0046] Figure 2 is a block diagram showing an example of the structure of an image decoder.

[0047] The image decoder (200) includes an entropy decoder (210), an inverse quantizer (220), an inverse transformer (230), an intra prediction unit (240), a motion compensation unit (250), an adder (255), a filter unit (260), and a reference picture buffer (270).

[0048] The image decoder (200) decodes the bitstream in an intra prediction mode or an inter prediction mode and outputs a restored image. The image decoder (200) transitions between the intra prediction mode and the inter prediction mode by switching a switch. The image decoder (200) obtains a difference block from the bitstream to generate a prediction block, and then adds the difference block to generate a restored block.

[0049] The entropy decoding unit (210) performs entropy decoding based on a probability distribution. The entropy decoding process is the reverse process of the entropy encoding process described above. That is, the entropy decoding unit (210) generates a symbol containing quantized coefficients from a bitstream in which frequently occurring symbols are represented by a small number of bits.

[0050] The inverse quantization unit (220) inversely quantizes the quantized coefficients, and the inverse transformation unit (230) inversely transforms the inversely quantized coefficients to generate a difference block.

[0051] In the case of the intra prediction mode, the intra prediction unit (240) generates a prediction block by performing spatial prediction using the pixel values ​​of already decoded blocks around the block to be decoded.

[0052] In the case of the inter-prediction mode, the motion compensation unit (250) generates a prediction block by performing motion compensation using a motion vector and a reference picture stored in the reference picture buffer (270).

[0053] The adder (255) adds a prediction block to the difference block, and the filter unit (260) performs at least one of deblocking filtering, SAO compensation, and ALF on the block that has passed through the adder to output a restored image.

[0054] Hereinafter, a block refers to a unit of encoding / decoding. During the encoding / decoding process, an image is divided into a predetermined size and encoded / decoded. Accordingly, a block may also be referred to as a macro block (MB), coding unit (CU), prediction unit (PU), or transform unit (TU), and a single block may be divided into smaller sub-blocks.

[0055] Here, a prediction unit refers to a basic unit for performing prediction and / or motion compensation. A prediction unit may be divided into multiple partitions, and each partition is referred to as a prediction unit partition. When a prediction unit is divided into multiple partitions, the prediction unit partition may serve as a basic unit for performing prediction and / or motion compensation. In the embodiments of the present invention below, a prediction unit may also refer to a prediction unit partition.

[0056] Additionally, in this specification, "using a sample" may mean using information of said sample, such as pixel values. However, it should be noted that for the sake of convenience of explanation, expressions such as "using sample information" or "using pixel values" may be simply expressed as "using the sample."

[0057] On the other hand, when transmitting a bitstream over an error-prone network channel, there is a high probability of errors occurring within the reconstructed picture. Constrained Intra Prediction (CIP) is a prediction method that generates a prediction block for the current block by referencing only neighboring samples belonging to a block encoded in intra prediction mode, without referencing neighboring samples belonging to a block not encoded in intra prediction mode (covered). Here, the current block refers to the block to be encoded or the block to be decoded. When using CIP mode, even if the referenced picture is lost and the block encoded in inter prediction mode cannot be successfully reconstructed, the generation of the intra prediction block is unaffected. Therefore, even if the block encoded in inter prediction mode cannot be successfully reconstructed, the block encoded in intra prediction mode can be successfully decoded.

[0058] However, since in-loop filtering is performed regardless of whether CIP mode is used, if an error occurs within the compressed video bitstream, the error in the restored video may propagate to other areas where no error occurred during the in-loop filtering process.

[0059] To solve the aforementioned problem, the present invention determines whether to perform in-loop filtering based on whether the CIP mode is used and the encoding parameters of blocks located on both sides of the filtering target boundary.

[0060] FIG. 3 is a flowchart illustrating an in-loop filtering method (encoding) according to one embodiment of the present invention.

[0061] The video encoder determines whether to use CIP mode (S310).

[0062] The encoder and decoder can signal information to determine whether to use CIP mode. For example, information to determine whether to use CIP mode is signaled through SPS (Sequence Parameter Set), PPS (Picture Parameter Set), or slice header, etc.

[0063] At this time, signaling information to determine whether CIP mode is used means that an encoder inserts an indicator, such as a flag indicating whether CIP mode is used, into the bitstream, and a decoder parses it. The indicator is inserted into the bitstream through an entropy coding process, such as arithmetic coding, in the encoder, and can be extracted in the decoder through a decoding process corresponding to that entropy coding process.

[0064] For example, to determine whether CIP mode is used in the sequence to be encoded, a constrained_intra_pred_flag as shown in Table 1 may be transmitted. If the flag value is '0', it is determined that CIP mode is not used, and if the flag value is '1', it is determined that CIP mode is used.

[0065]

[0066] For example, to determine whether the picture to be encoded uses CIP mode, the constrained_intra_pred_flag can be transmitted as shown in Table 2. As with signaling via SPS, if the flag value is '0', it is determined that CIP mode is not used, and if the flag value is '1', it is determined that CIP mode is used.

[0067]

[0068] Meanwhile, special-purpose encoders and decoders used in error-prone network environments may use CIP mode by default without separately signaling information to determine whether to use CIP mode.

[0069] Figure 4 is a conceptual diagram illustrating an example of a limited intra-prediction being performed.

[0070] Hereinafter, for convenience of explanation, [x, y] coordinates are set such that the coordinate value increases in the lower right direction with the upper left sample of the encoding target block (400) as the reference ([0, 0]). Also, p[a, b] represents the pixel value of the sample having the position [a, b]. For example, the pixel value of the upper left sample of the encoding target block (400) can be represented as p[0, 0].

[0071] When the size of the encoding target block (400) is 8x8, a prediction block for the encoding target block is generated using reference samples located at the top and left of the encoding target block (400), namely the top reference sample (p[-1...15, -1]) and the left reference sample (p[-1, 0...15]).

[0072] However, when CIP mode is used, as described above, surrounding samples belonging to blocks not encoded in intra prediction mode cannot be used for intra prediction, so a reference sample substitution process is required. For example, in Figure 4, samples with positions [x = -1, y = 4...11], [x = -1...5, y = -1], and [x = 8...15, y = -1] must be replaced with other samples that can be used for limited intra prediction.

[0073] The following is an example of constructing a reference sample by replacing surrounding samples that cannot be used for intra-prediction.

[0074] Example 1) Replace neighboring samples that cannot be used for intra-prediction with one of the neighboring samples that can be used for intra-prediction.

[0075] For example, in the case of Fig. 4, if the sample at the location [x = -1, y = 15] is a sample that cannot be used for intra prediction, the search is performed sequentially from [x = -1, y = 15] to [x = -1, y = -1], and then from [x = 0, y = -1] to [x = 15, y = -1]. As soon as a sample that can be used for intra prediction is found, the search is terminated, and the pixel value of the found sample (p[x = -1, y = 15]) is assigned to the pixel value of the corresponding sample.

[0076] For example, in the case of Fig. 4, if a sample with a position [x = -1, y = 4...11] or [x = -1, y = -1] is a sample that cannot be used for intra-prediction, then the pixel value (p[x, y]) of the sample is assigned to the pixel value (p[x, y+1]) of the sample located below it, as in Equations 1 and 2.

[0077]

[0078]

[0079] For example, in the case of Fig. 4, if a sample with a position [x = 0...5, y = -1] or [x = 8...15, y = -1] is a sample that cannot be used for intra-prediction, then the pixel value (p[x, y]) of the sample located to the left of the sample is assigned to the pixel value (p[x-1, y]) of the sample, as in Equations 3 and 4.

[0080]

[0081]

[0082] Example 2) Replace the reference sample(s) that cannot be used for intra-prediction with the average value of the reference samples that can be used for intra-prediction located on both sides of the reference sample(s).

[0084] *For example, in the case of FIG. 4, surrounding samples belonging to a block encoded in inter-prediction mode are replaced as in Equations 5 to 7.

[0085]

[0086]

[0087]

[0088] Example 3) Replace reference sample(s) that cannot be used for intra-prediction with linearly interpolated reference samples that can be used for intra-prediction located on both sides of the reference sample(s).

[0089] For example, in the case of FIG. 4, surrounding samples belonging to a block encoded in inter-prediction mode are replaced as in Equations 8 to 10.

[0090]

[0091]

[0092]

[0093] Meanwhile, when the block to be encoded is encoded in intra-prediction mode, filtering can be performed on reference samples and predicted samples to improve encoding performance. Here, predicted samples refer to the predicted values ​​of samples belonging to the block to be encoded.

[0094] For example, a 3-tap low-pass filter with filter coefficients of

[0121] or a 2-tap average filter with filter coefficients of

[0011] can be applied to a reference sample.

[0095] For example, in specific intra modes such as Intra_Vertical prediction mode, Intra_Horizontal prediction mode, and Intra_DC prediction mode, the predicted value of a sample corresponding to the boundary of the block to be encoded can be derived based on a reference sample adjacent to that sample.

[0096] However, when CIP mode is used, neighboring samples not encoded in intra-prediction mode are replaced by neighboring samples encoded in intra-prediction mode; thus, there is a high probability that the pixel values ​​of the reference samples are similar or identical to one another. Therefore, unlike when CIP mode is not used, in a restricted intra-prediction mode, it may be desirable not to perform filtering on the reference samples in terms of reducing computational complexity and improving encoding performance. Similarly, since the pixel values ​​of the prediction samples derived based on reference samples having similar or identical pixel values ​​are also highly likely to be similar or identical to one another, it may be desirable not to perform filtering on the prediction samples.

[0097] Therefore, [1] whether to use CIP mode, [2] whether the block to which the reference sample belongs is available, [3] the pixel value of the reference sample, [4] the encoding parameter of the block to which the reference sample belongs, etc., can be adaptively determined whether to perform filtering on the reference sample and / or the prediction sample.

[0098] Example 1) Determine whether to perform filtering on reference samples and / or prediction samples based on whether CIP mode is used.

[0099] For example, in an environment where CIP mode is used, if a filter is applied to a reference sample, filtering may not be performed on the reference sample in the inter-slice (P slice or B slice).

[0100] For example, when applying a filter to prediction samples in an environment where CIP mode is used, filtering may not be performed on prediction samples in the inter-slice (P slice or B slice).

[0101] Example 2) Adaptively determine whether to perform filtering on reference samples and / or prediction samples based on the availability of the block to which the reference sample belongs.

[0102] For example, when applying a filter to reference samples, filtering may not be performed on reference samples that correspond to samples belonging to unavailable blocks and are replaced with samples available for intra-prediction.

[0103] For example, when applying a filter to prediction samples, filtering may not be performed on prediction samples derived based on reference samples that are replaced with samples available for intra-prediction, corresponding to samples belonging to unavailable blocks.

[0104] Example 3) Determine whether to perform filtering on the reference sample and / or the prediction sample based on the pixel values ​​of the reference sample. In this case, the mean, variance, and similarity of pixel values ​​measured based on whether the sample values ​​are identical to each other of the pixel values ​​of the reference samples may be used.

[0105] For example, when applying a filter to reference samples, filtering may not be performed on reference samples whose pixel values ​​are similar or identical to each other.

[0106] For example, when applying a filter to prediction samples, filtering may not be performed on prediction samples derived based on reference samples where pixel values ​​are similar or identical.

[0107] Example 4) Determine whether to perform filtering on the reference sample and / or the prediction sample based on the coding parameters of the block to which the reference sample belongs. At this time, at least one of the coding parameters such as intra prediction mode, MPM (Most Probable Mode) flag, inter prediction mode, motion vector, reference picture index, quantization parameter, coded block flag, and coding mode indicating whether the block to be encoded was encoded in intra prediction mode or inter prediction mode may be used.

[0108] For example, when applying a filter to a reference sample, filtering may not be performed on reference samples that correspond to samples belonging to a block not encoded in intra-prediction mode and are replaced with samples belonging to a block encoded in intra-prediction mode.

[0109] For example, when applying a filter to a prediction sample, filtering may not be performed on a prediction sample derived based on a reference sample that is replaced by a sample belonging to a block encoded in intra-prediction mode, corresponding to a sample belonging to a block not encoded in intra-prediction mode.

[0110] Meanwhile, for specific intra modes such as Intra_Vertical prediction mode, Intra_Horizontal prediction mode, and Intra_DC prediction mode, as described above, a filter can be applied only to prediction samples that correspond to the boundaries of the block to be encoded among the prediction samples. Even in the above case, [1] whether CIP mode is used, [2] whether the block to which the reference sample belongs is available, [3] the pixel value of the reference sample, [4] the encoding parameter of the block to which the reference sample belongs, etc., can be adaptively determined whether to perform filtering on prediction samples that correspond to the boundaries of the block to be encoded among the prediction samples. Referring again to FIG. 4, filtering may not be performed on prediction samples (410, 420) having positions [0...5, 0] and [0, 4...7].

[0111] Figure 5 is a flowchart illustrating a method for performing in-loop filtering on a block encoded in a limited intra-prediction mode.

[0112] Hereinafter, for the sake of convenience of explanation, in-loop filtering will be described using the example of deblocking filtering. However, the present invention is not limited to deblocking filtering but can also be applied to non-deblocking filtering, SAO (Sample Adaptive Offset) compensation, or Adaptive Loop Filter (ALF).

[0113] The encoder determines the boundary to be filtered (S510). Generally, the boundary of the image segmentation unit is determined as the boundary to be filtered. For example, the boundary of the Coding Unit (CU), the boundary of the Prediction Unit (PU), and the boundary of the Transform Unit (TU) may be determined as the boundary to be filtered. Accordingly, the determination of the boundary to be filtered is performed at the Coding Unit (CU), LCU (Largest Coding Unit), slice unit, or picture unit.

[0114] The encoder determines whether to perform filtering and the type of filter based on at least one of the surrounding pixel values ​​of the filtering target boundary determined through the filtering boundary determination step (S510) and the filtering strength (S520). For example, based on the surrounding pixel values ​​of the filtering target boundary, it can determine whether the filtering target boundary is a blocking artifact caused by transform and quantization or an actual edge existing within the picture, and determine whether to perform filtering. For example, the filter strength may represent the tap size, which indicates the number of input samples of the low-pass filter, the coefficient of the low-pass filter, etc.

[0115] The encoder performs filtering based on the filtering target boundary and the type of filter determined through the filtering target boundary determination step (S510) and the step of determining whether to perform filtering and the type of filter (S520). At this time, a low-pass filter may be used to smooth the boundary between blocks based on the amount of change in surrounding pixel values ​​of the filtering target boundary, or a Wiener filter may be applied to minimize distortion with respect to the original image. Additionally, a one-dimensional filter or a multi-dimensional filter of two or more dimensions may be applied depending on the filtering target boundary. For example, a multi-dimensional filter of two or more dimensions may be applied, having a filter shape such as a square, circle, or rectangle, and a filter coefficient structure such as horizontal symmetry, vertical symmetry, or diagonal symmetry. Furthermore, various filters may be applied based on the filtering strength determined through the step of determining whether to perform filtering and the type of filter (S520).

[0116] Referring again to FIG. 3, the image encoder determines the encoding parameters of blocks located on both sides of the filtering target boundary (S320).

[0117] The video encoder can determine whether to perform filtering and the type of filter based on the coding parameters of blocks located on both sides of the filtering target boundary. In this case, at least one of the coding parameters, such as an intra prediction mode, an inter prediction mode, a motion vector, a reference picture index, a quantization parameter, a coded block flag, and a coding mode indicating whether the block to be encoded was encoded in an intra prediction mode or an inter prediction mode, may be used.

[0118] For example, an image encoder can determine whether blocks located on both sides of a filtering target boundary are encoded in intra-prediction mode or in inter-prediction mode. In this case, if a block is encoded in intra-prediction mode, it can be said that the block is encoded in intra-mode or is intra-coded. Likewise, if a block is encoded in inter-prediction mode, it can be said that the block is encoded in inter-mode or is inter-coded.

[0119] For example, if blocks located on both sides of the filtering target boundary are encoded in an inter-prediction mode, the image encoder can determine whether there are transform coefficients for residual signals such as the Coded Block Flag (CBF) and skip mode, and based on this, the processing method of the deblocking filter can be different.

[0120] For example, if blocks located on both sides of the filtering target boundary are encoded in Pulse Coded Modulation (PCM) mode, the image encoder can determine that the blocks are encoded in intra-prediction mode.

[0121] In addition, the video encoder can determine whether to perform filtering and the type of filter based on the surrounding pixel values ​​of the filtering target boundary, along with the encoding parameters of the blocks located on both sides of the filtering target boundary. In this case, the difference, gradient, variance, average, etc., of the surrounding pixel values ​​of the filtering target boundary can be used.

[0122] The video encoder determines whether to apply an in-loop filter based on whether CIP mode is used and the encoding parameters of the blocks located on both sides of the filtering target boundary.

[0123] When CIP mode is not used, the image encoder performs filtering on samples located on both sides of the filtering target boundary (S330).

[0124] When CIP mode is used and the encoding parameters of blocks located on both sides of the filtering target boundary indicate that blocks located on both sides of the filtering target boundary are blocks encoded in intra-prediction mode, the image encoder performs filtering on samples located on both sides of the filtering target boundary (S331).

[0125] Figure 6 illustrates an example where blocks located on both sides of a filtering target boundary are encoded in intra-prediction mode. When both blocks are intra-coded, samples belonging to both blocks are not affected by blocks encoded in intra-prediction mode, which can cause errors. Therefore, when constrained_intra_pred_flag is 1 and blocks located on both sides of a filtering target boundary are encoded in intra-prediction mode, deblocking filtering can be performed on the filtering target boundary.

[0126] When CIP mode is used and the encoding parameters of blocks located on both sides of the filtering target boundary indicate that blocks located on both sides of the filtering target boundary are all blocks encoded in the inter-prediction mode, the image encoder may not apply a deblocking filter to samples located on both sides of the filtering target boundary (S333[1]).

[0127] Figure 7 illustrates an example where blocks located on both sides of a filtering target boundary are encoded in the inter-prediction mode. When both blocks are inter-coded (merge mode, skip mode, PU_2Nx2N / PU_2NxN / PU_Nx2N / PU_NxN mode), errors may occur in the samples belonging to both blocks. Therefore, when constrained_intra_pred_flag is 1 and the encoding parameters of the blocks located on both sides of the filtering target boundary are both in the inter-prediction mode, the image encoder may not perform filtering on the samples located on both sides of the filtering target boundary.

[0128] In addition, if constrained_intra_pred_flag is 1 and the encoding parameters of the blocks located on both sides of the filtering target boundary are both in inter-prediction mode, the image encoder may determine the filtering strength to be '0', as if no filtering were performed. Equation 11 shows an example of determining the filtering strength to be '0'.

[0129]

[0130] Here, bS represents the filtering strength, filterDir represents the application direction (vertical / horizontal) of the 1D filter, and xEk and yEj represent the positions of the filtering target boundaries.

[0131] Additionally, when constrained_intra_pred_flag is 1 and the encoding parameters of blocks located on both sides of the filtering target boundary are both in inter-prediction mode, errors may occur in the samples belonging to both blocks, but it can be considered that this is not a problem caused by performing deblocking filtering on those samples. Therefore, the image encoder may perform filtering on samples located on both sides of the filtering target boundary (S333[2]).

[0132] When CIP mode is used and the encoding parameters of blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks encoded in intra prediction mode and inter prediction mode, respectively, the image encoder can perform filtering only on the samples belonging to the blocks encoded in inter prediction mode among the samples located on both sides of the filtering target boundary (S332[1]).

[0133] FIGS. 8 and 9 illustrate an example in which blocks located on both sides of a filtering target boundary are encoded in an intra-prediction mode and an inter-prediction mode, respectively. When blocks encoded in an intra-prediction mode and blocks encoded in an inter-prediction mode are located on both sides of a filtering target boundary, an error occurring in a restored sample belonging to a block encoded in an inter-prediction mode may affect a restored sample belonging to a block encoded in an intra-prediction mode. Therefore, by not performing filtering on samples belonging to a block encoded in an intra-prediction mode among the samples on both sides of the filtering target boundary, and by performing filtering only on samples belonging to a block encoded in an inter-prediction mode among the samples on both sides of the filtering target boundary, the propagation of errors can be prevented.

[0134] When filtering is performed only on samples belonging to a block encoded in inter-prediction mode among the samples on both sides of the filtering target boundary, the following deblocking filtering process is performed.

[0135] <Deblocking Filtering Process for Luminance (luma) Samples 1>

[0136] - Input

[0137] (1) Sample values: pi, qi (i = 0...3)

[0138] (2) Whether to apply filters to samples p1 and q1 respectively: dEp1, dEq1

[0139] (3) Threshold for applying the filter: tc

[0140] - Output

[0141] (1) Number of filtered samples: nDp, nDq

[0142] (2) Filtered sample values: pi', qj'(i = 0...nDp -1, j = 0...nDq - 1)

[0143] - [1] If pi is not a sample of the I_PCM block, or pcm_loop_filter_disable_flag is 0, [2] pi belongs to a block encoded in inter-prediction mode, [3] qi belongs to a block encoded in intra-prediction mode, and [4] dE is 2, set nDp to 3 and apply the following strong filter to pi.

[0144]

[0145]

[0146]

[0147] Here, Clip3(a, b, c) indicates clipping c within the range of a and b.

[0148] - [1] If pi is not a sample of the I_PCM block, or pcm_loop_filter_disable_flag is 0, [2] pi belongs to a block encoded in inter-prediction mode, [3] qi belongs to a block encoded in intra-prediction mode, and [4] dE is not 2, set nDp to 1 and apply a weak filter to pi.

[0149]

[0150] If abs(Δ) is less than tc*10, the following steps are applied.

[0151] (1) p0' is obtained as follows.

[0152]

[0153]

[0154] Here, Clip1Y(x) is defined as in Equation 18.

[0155]

[0156] Here, BitDepthY represents the bit depth of the luminance component.

[0157] (2) If dEp1 is 1, pi' is calculated as follows.

[0158]

[0159]

[0160] (3) nDp becomes dEp1+1.

[0161] - [1] If qi is not a sample of the I_PCM block, or pcm_loop_filter_disable_flag is 0, [2] qi belongs to a block encoded in inter-prediction mode, [3] pi belongs to a block encoded in intra-prediction mode, and [4] dE is 2, set nDq to 3 and apply the following strong filter to qi.

[0162]

[0163]

[0164]

[0165] Here, Clip3(a, b, c) indicates clipping c within the range of a and b.

[0166] - [1] If qi is not a sample of the I_PCM block, or pcm_loop_filter_disable_flag is 0, [2] if qi belongs to a block encoded in inter-prediction mode, [3] if pi belongs to a block encoded in intra-prediction mode, and [4] if dE is not 2, set nDq to 1 and apply a weak filter to qi.

[0167]

[0168] If abs(Δ) is less than tc*10, the following steps are applied.

[0169] (1) q0' is obtained as follows.

[0170]

[0171]

[0172] Here, Clip1Y(x) is defined as in Equation 27.

[0173]

[0174] Here, BitDepthY represents the bit depth of the luminance component.

[0175] (2) If dEq1 is 1, qi' is obtained as follows.

[0176]

[0177]

[0178] (3) nDq becomes dEq1+1.

[0179] Meanwhile, deblocking filtering can also be performed on luminance (luma) samples as follows.

[0180] <Deblocking Filtering Process for Luminance (luma) Samples 2>

[0181] - Input

[0182] (1) Sample values: pi, qi (i = 0...3)

[0183] (2) Whether to apply filters to samples p1 and q1 respectively: dEp1, dEq1

[0184] (3) Threshold for applying the filter: tc

[0186] *- Output

[0187] (1) Number of filtered samples: nDp, nDq

[0188] (2) Filtered sample values: pi', qj'(i = 0...nDp -1, j = 0...nDq - 1)

[0189] - If dE is 2, set nDp and nDq to 3 and apply a strong filter.

[0190]

[0191]

[0192]

[0193]

[0194]

[0195]

[0196] Here, Clip3(a, b, c) indicates clipping c within the range of a and b.

[0197] - If dE is not 2, set nDp and nDq to 1 and apply a weak filter.

[0198]

[0199] If abs(Δ) is less than tc*10, the following steps are applied.

[0200] (1) p0' and q0' are obtained as follows.

[0201]

[0202]

[0203]

[0204] Here, Clip1Y(x) is defined as in Equation 40.

[0205]

[0206] Here, BitDepthY represents the bit depth of the luminance component.

[0207] (2) If dEp1 is 1, pi' is calculated as follows.

[0208]

[0209]

[0210] (3) If dEq1 is 1, qi' is obtained as follows.

[0211]

[0212]

[0213] (4) nDp becomes dEp1+1 and nDq becomes dEq1+1.

[0214] - If at least one of the following two conditions is satisfied, pi'(i = 0...nDp-1) is changed to the input sample pi.

[0215] (1) pi is a sample of the I_PCM block, and pcm_loop_filter_disable_flag is 1.

[0216] (2) pi belongs to a block encoded in intra-prediction mode, and qi belongs to a block encoded in inter-prediction mode.

[0217] - If at least one of the following two conditions is satisfied, qj' (j = 0...nDq-1) is changed to the input sample qj.

[0218] (1) qj is a sample of the I_PCM block, and pcm_loop_filter_disable_flag is 1.

[0219] (2) qj belongs to a block encoded in intra-prediction mode, and pj belongs to a block encoded in inter-prediction mode.

[0220] Meanwhile, deblocking filtering can be performed on chroma samples as follows.

[0221] <Deblocking Filtering Process for Chroma Samples 1>

[0222] - Input

[0223] (1) Sample values: pi, qi (i = 0, 1)

[0224] (2) Threshold for applying the filter: tc

[0225] - Output

[0227] *

[0228] *(1) Filtered sample values: p0', q0'

[0229] - [1] If pi is not a sample of the I_PCM block, or pcm_loop_filter_disable_flag is 0, [2] if pi belongs to a block encoded in inter-prediction mode, and [3] if qi belongs to a block encoded in intra-prediction mode, apply the following filter.

[0230]

[0231]

[0232] - [1] If qi is not a sample of the I_PCM block, or pcm_loop_filter_disable_flag is 0, [2] if qi belongs to a block encoded in inter-prediction mode, and [3] if pi belongs to a block encoded in intra-prediction mode, apply the following filter.

[0233]

[0234]

[0235] Meanwhile, deblocking filtering can also be performed on chroma samples as follows.

[0236] <Deblocking Filtering Process for Chroma Samples 2>

[0237] - Input

[0238] (1) Sample values: pi, qi (i = 0, 1)

[0239] (2) Threshold for applying the filter: tc

[0240] - Output

[0241] (1) Filtered sample values: p0', q0'

[0242] - Apply the following filters.

[0243]

[0244]

[0245]

[0246] - If at least one of the following two conditions is satisfied, p0' is changed to the input sample p0.

[0247] (1) p0 is a sample of the I_PCM block, and pcm_loop_filter_disable_flag is 1.

[0248] (2) p0 belongs to a block encoded in intra-prediction mode, and q0 belongs to a block encoded in inter-prediction mode.

[0249] - If at least one of the following two conditions is satisfied, q0' is changed to the input sample q0.

[0250] (1) q0 is a sample of the I_PCM block, and pcm_loop_filter_disable_flag is 1.

[0251] (2) q0 belongs to a block encoded in intra-prediction mode, and p0 belongs to a block encoded in inter-prediction mode.

[0252] Meanwhile, if CIP mode is used and the encoding parameters of blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks encoded in intra prediction mode and inter prediction mode, respectively, the image encoder may not perform filtering on samples located on both sides of the filtering target boundary (S332[2]).

[0253] For example, if one of the blocks located on both sides of the filtering target boundary is encoded in an intra-prediction mode (PU_2Nx2N or PU_NxN), filtering may not be performed without determining the filtering strength.

[0254] In addition, when CIP mode is used and the encoding parameters of blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks encoded in intra-prediction mode and inter-prediction mode, respectively, the image encoder may determine the filtering strength to be '0', as if no filtering were performed. Equation 52 shows an example of determining the filtering strength to be '0'.

[0255]

[0256] Here, bS represents the filtering strength, filterDir represents the application direction (vertical / horizontal) of the 1D filter, and xEk and yEj represent the positions of the filtering target boundaries.

[0257] Meanwhile, if the block to be filtered is an I_PCM block and pcm_loop_filter_disable_flag is '1', deblocking filtering is not performed. Here, an I_PCM block signifies that the block to be filtered is a block encoded in PCM mode using uncompressed original samples, and pcm_loop_filter_disable_flag is a flag indicating whether the loop filter process is performed on the restored pixels of the I_PCM block. Therefore, the decision to perform filtering can be made by including the case where the block to be filtered is an I_PCM block.

[0258] FIG. 10 is a flowchart illustrating a method for performing deblocking filtering based on whether CIP mode and PCM mode are used and the encoding parameters of blocks located on both sides of the filtering target boundary.

[0259] When CIP mode is used, that is, when constrained_intra_pred_flag is '1', determine the encoding modes of blocks P and Q located on both sides of the filtering target boundary.

[0260] If blocks located on both sides of the filtering target boundary are encoded in intra-prediction mode and inter-prediction mode, respectively, the image encoder does not perform filtering on samples belonging to the block encoded in intra-prediction mode among the samples located on both sides of the filtering target boundary.

[0261] If blocks located on both sides of the filtering target boundary are both encoded in intra-prediction mode, or if blocks located on both sides of the filtering target boundary are both encoded in inter-prediction mode, the image encoder determines pcm_loop_filter_disable_flag.

[0262] If pcm_loop_filter_disable_flag is '1', determine whether blocks P and Q located on both sides of the filtering target boundary are each I_PCM blocks, and do not perform filtering on the blocks that are I_PCM blocks.

[0263] If CIP mode is not used, that is, if constrained_intra_pred_flag is '0', the video encoder determines pcm_loop_filter_disable_flag.

[0264] If pcm_loop_filter_disable_flag is '1', determine whether blocks P and Q located on both sides of the filtering target boundary are each I_PCM blocks, and do not perform filtering on the blocks that are I_PCM blocks.

[0265] FIG. 11 is a flowchart illustrating an in-loop filtering method (decoding) according to one embodiment of the present invention.

[0266] The decoder can determine whether to perform in-loop filtering in the same way as the encoder. That is, the image decoder determines whether to use CIP mode (S1110).

[0267] When CIP mode is used, the image decoder determines the decoding parameters of blocks located on both sides of the filtering target boundary of the block to be decoded (S1120).

[0268] The video decoder determines whether to apply an in-loop filter based on whether CIP mode is used and the decoding parameters of the blocks located on both sides of the filtering target boundary.

[0269] For example, if CIP mode is not used, the image decoder performs filtering on samples located on both sides of the filtering target boundary (S1130).

[0270] For example, if CIP mode is used and the decoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks decoded in intra-prediction mode, the image decoder performs filtering on the samples located on both sides of the filtering target boundary (S1131).

[0271] For example, if CIP mode is used and the decoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks decoded in the inter-prediction mode, the image decoder may not apply a deblocking filter to the samples located on both sides of the filtering target boundary (S1133[1]).

[0272] For example, if CIP mode is used and the decoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks that have been decoded in the inter-prediction mode, the image decoder may perform filtering on the samples located on both sides of the filtering target boundary (S1133[2]).

[0273] For example, if CIP mode is used and the decoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks decoded in intra prediction mode and inter prediction mode, respectively, the image decoder can perform filtering only on the samples belonging to the blocks decoded in inter prediction mode among the samples located on both sides of the filtering target boundary (S1132[1]).

[0274] For example, if CIP mode is used and the decoding parameters of the blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks decoded in intra prediction mode and inter prediction mode, respectively, the image decoder may not perform filtering on the samples located on both sides of the filtering target boundary (S1132[2]).

[0275] FIG. 12 is a flowchart illustrating an image encoding method according to one embodiment of the present invention.

[0276] The video encoder signals information to determine whether to use a restricted in-loop filter (S1210). Here, the restricted in-loop filter refers to an in-loop filter applied based on whether to use CIP mode and the encoding parameters of blocks located on both sides of the filtering target boundary. Signaling information to determine whether to use a restricted in-loop filter means that the encoder inserts an indicator, such as a flag indicating whether to use a restricted in-loop filter, into the bitstream, and the decoder parses it.

[0277] When a restricted in-loop filter is used, [1] filtering may be performed only on samples belonging to blocks encoded in inter-prediction mode among samples located on both sides of the filtering boundary, [2] filtering may not be performed on samples located on both sides of the filtering boundary, or [3] filtering may be performed on samples located on both sides of the filtering boundary.

[0278] For example, if the encoding parameters of blocks located on both sides of the filtering target boundary indicate that the blocks located on both sides of the filtering target boundary are blocks encoded in intra-prediction mode and inter-prediction mode, respectively, filtering can be performed only on samples belonging to blocks encoded in inter-prediction mode among the samples located on both sides of the filtering target boundary.

[0279] For example, if the encoding parameters of blocks located on both sides of the filtering target boundary indicate that blocks located on both sides of the filtering target boundary are all blocks encoded in inter-prediction mode, filtering may not be performed on samples located on both sides of the filtering target boundary.

[0280] For example, if the encoding parameters of blocks located on both sides of the filtering target boundary indicate that blocks located on both sides of the filtering target boundary are all blocks encoded in intra-prediction mode, filtering can be performed on samples located on both sides of the filtering target boundary.

[0281] The encoder may signal information indicating that at least one of the above examples is applied, that is, information for determining whether a restricted in-loop filter is used. In this case, the signaling may be performed in the Coding Unit (CU), Prediction Unit (PU), Transform Unit (TU), Largest Coding Unit (LCU), slice unit, or picture unit.

[0282] For example, when signaling information indicating whether a restricted in-loop filter is used via PPS, the constrained_in_loop_filter_flag can be transmitted as shown in Table 3.

[0283]

[0284] In this case, if constrained_in_loop_filter_flag is '1', a restricted in-loop filter is used, and if constrained_in_loop_filter_flag is '0', a restricted in-loop filter may not be used.

[0285] Meanwhile, the video encoder can decide whether to signal information to determine whether to use a restricted in-loop filter based on whether the CIP mode is used.

[0286] For example, when CIP mode is used (constrained_intra_pred_flag = 1), information to determine whether to use a restricted in-loop filter is signaled, and when CIP mode is not used (constrained_intra_pred_flag = 0), information to determine whether to use a restricted in-loop filter is not signaled.

[0287] Additionally, the video encoder can determine whether to signal information to determine whether to use a restricted in-loop filter based on the encoding parameters of blocks located on both sides of the filtering target boundary.

[0288] For example, if one or more blocks among the blocks located on both sides of the filtering target boundary are encoded in an inter-prediction mode, information for determining whether to use a restricted in-loop filter can be signaled.

[0289] Table 4 shows an example of determining whether to signal information to determine whether to use a restricted in-loop filter based on the encoding parameters of blocks located on both sides of the filtering target boundary.

[0290]

[0291] In addition, the video encoder may also signal information by default to determine whether to use a restricted in-loop filter.

[0292] The image encoder determines the encoding parameters of the blocks located on both sides of the filtering target boundary (S1220). At this time, the image encoder can determine the encoding parameters of the blocks located on both sides of the filtering target boundary in the same way as the "step of determining the encoding parameters of the blocks located on both sides of the filtering target boundary (S320)" in FIG. 3.

[0293] The video encoder determines whether to apply an in-loop filter based on information for determining whether to use a restricted in-loop filter and encoding parameters of blocks located on both sides of the filtering target boundary (S1230).

[0294] FIG. 13 is a flowchart illustrating an image decoding method according to an embodiment of the present invention.

[0295] The decoder can determine whether to use a restricted in-loop filter in a manner corresponding to that of the encoder. That is, the image decoder parses information to determine whether to use a restricted in-loop filter (S1310).

[0296] The image decoder determines the decoding parameters of the blocks located on both sides of the filtering target boundary (S1320).

[0297] The image decoder determines whether to apply an in-loop filter based on information for determining whether to use a restricted in-loop filter and decoding parameters of blocks located on both sides of the filtering target boundary (S1330).

[0298] The order of the steps described above is not limited, and some steps may occur in a different order or simultaneously with other steps. Furthermore, those skilled in the art to which the present invention pertains will understand that the steps shown in the flowchart are not exclusive and that other steps may be included or some steps may be omitted.

[0299] Furthermore, the embodiments described above include examples of various aspects. While it is not possible to describe all possible combinations to represent various aspects, those skilled in the art will recognize that other combinations are possible. Accordingly, the present invention shall be understood to include all other substitutions, modifications, and changes falling within the scope of the following claims.

Claims

Claim 1 A video decoding method comprising: a step of determining whether a Constrained Intra Prediction (CIP) mode is applied to a current block; a step of constructing reference samples from surrounding samples of the current block based on whether the CIP mode is applied; and a step of generating a restored block based on a prediction for the current block using the reference samples, wherein the step of constructing the reference samples includes a step of replacing the sample value of an unavailable sample among the surrounding samples of the current block that cannot be used for intra prediction with the sample value of an available sample among the surrounding samples of the current block that can be used for intra prediction, wherein if the unavailable sample is a surrounding sample located at the top of the current block, the available sample is a sample located to the left of the unavailable sample, and a sample belonging to a block not encoded in an intra prediction mode is determined to be the unavailable sample. Claim 2 A video encoding method comprising: a step of determining whether a Constrained Intra Prediction (CIP) mode is applied to a current block; a step of constructing reference samples from surrounding samples of the current block based on whether the CIP mode is applied; and a step of encoding the current block based on predicting the current block using the reference samples, wherein the step of constructing the reference samples includes a step of replacing the sample value of an unavailable sample among the surrounding samples of the current block that cannot be used for intra prediction with the sample value of an available sample among the surrounding samples of the current block that can be used for intra prediction, wherein if the unavailable sample is a surrounding sample located at the top of the current block, the available sample is a sample located to the left of the unavailable sample, and a sample belonging to a block not encoded in an intra prediction mode is determined to be the unavailable sample. Claim 3 A computer-readable recording medium for storing a bitstream generated by a video encoding method, wherein the video encoding method comprises: a step of determining whether a Constrained Intra Prediction (CIP) mode is applied to a current block; a step of constructing reference samples from surrounding samples of the current block based on whether the CIP mode is applied; and a step of encoding the current block based on predicting the current block using the reference samples, wherein the step of constructing the reference samples includes a step of replacing the sample value of an unavailable sample among the surrounding samples of the current block that cannot be used for intra prediction with the sample value of an available sample among the surrounding samples of the current block that can be used for intra prediction, wherein if the unavailable sample is a surrounding sample located at the top of the current block, the available sample is a sample located to the left of the unavailable sample, and a sample belonging to a block not encoded in an intra prediction mode is determined to be the unavailable sample.