Image decoding method and apparatus dependent on intra prediction in image coding system

By generating reference samples and performing intra prediction, the high cost problem of high-resolution images is solved, encoding efficiency and prediction accuracy are improved, and transmission and storage costs are reduced.

CN120547355APending Publication Date: 2025-08-26GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510876789.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2016-10-11
Filing Date
2017-08-30
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

The transmission and storage costs of high resolution and high-quality images are relatively high, and it is difficult for the prior art to effectively compress image data.

Method used

By deriveing ​​the adjacent samples on multiple rows and left-neighbor samples of the current block, a reference sample is generated, and intra prediction is performed based on the reference sample, improving prediction accuracy and coding efficiency.

Benefits of technology

The prediction accuracy and overall encoding efficiency of the current block are improved, and the cost of image transmission and storage is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120547355A_ABST
    Figure CN120547355A_ABST
Patent Text Reader

Abstract

An image decoding method performed by a decoding device according to the present invention comprises: a step of deriving an intra prediction mode of a current block; deriving upper neighboring samples of a plurality of rows and left neighboring samples of a plurality of columns of the current block; deriving a row of upper reference samples on the basis of the upper adjacent samples; deriving a column of left reference samples based on the left adjacent samples; and a step of generating a prediction sample for the current block by using at least one of the upper reference sample and the left reference sample according to the intra prediction mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an image coding technology, and more particularly, to an image decoding method and apparatus based on intra-frame prediction in an image coding system. Background Art

[0002] The demand for high-resolution, high-quality images, such as HD (High Definition) and UHD (Ultra High Definition), is increasing across various fields. Because image data has high resolution and high quality, the amount of information, or bits, to be transmitted increases relative to conventional image data. Consequently, when image data is transmitted using media such as conventional wired / wireless broadband lines or stored using existing storage media, transmission and storage costs increase.

[0003] Therefore, there is a need for an efficient image compression technology for effectively transmitting, storing, and reproducing information of high-resolution and high-quality images. Summary of the Invention

[0004] Technical Purpose

[0005] The present invention provides a method and apparatus for enhancing image coding efficiency.

[0006] The present invention also provides a method and apparatus for generating reference samples based on a plurality of neighboring samples of a current block and performing intra-frame prediction based on the reference samples.

[0007] Technical Solutions

[0008] In one aspect, a method for decoding an image performed by a decoding device is provided. The method includes deriving an intra-frame prediction mode for a current block; deriving multiple rows of upper neighboring samples and multiple columns of left neighboring samples for the current block; deriving a row of upper reference samples based on the upper neighboring samples; deriving a column of left reference samples based on the left neighboring samples; and generating a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra-frame prediction mode.

[0009] In another aspect, a decoding apparatus for decoding an image is provided. The decoding apparatus includes an entropy decoding unit configured to obtain prediction information about a current block; and a prediction unit configured to derive an intra-frame prediction mode for the current block, derive multiple rows of upper neighboring samples and multiple columns of left neighboring samples for the current block, derive a row of upper reference samples based on the upper neighboring samples, derive a column of left reference samples based on the left neighboring samples, and generate a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra-frame prediction mode.

[0010] In another aspect, a method for encoding video performed by an encoding device is provided. The method includes determining an intra-frame prediction mode for a current block; deriving multiple rows of upper neighboring samples and multiple columns of left neighboring samples for the current block; deriving a row of upper reference samples based on the upper neighboring samples; deriving a column of left reference samples based on the left neighboring samples; generating a prediction sample for the current block using at least one of the upper reference sample and the left reference sample according to the intra-frame prediction mode; and generating, encoding, and outputting prediction information for the current block.

[0011] In another aspect, a video encoding device is provided. The encoding device includes: a prediction unit configured to determine an intra-frame prediction mode of a current block, derive multiple rows of upper neighboring samples and multiple columns of left neighboring samples of the current block, extract a row of upper reference samples based on the upper reference samples, extract a column of left reference samples based on the left reference samples, and generate a prediction sample of the current block using at least one of the upper reference samples and the left reference samples according to the intra-frame prediction mode; and an entropy encoding unit configured to generate, encode, and output prediction information for the current block.

[0012] Beneficial effects of the present invention

[0013] According to the present invention, reference samples of the current block can be derived based on multiple neighboring samples, and by performing intra-frame prediction based on the reference samples, the prediction accuracy of the current block can be improved, thereby improving the overall coding efficiency.

[0014] According to the present invention, reference samples can be derived based on multiple neighboring samples positioned in the prediction direction of the intra-frame prediction mode of the current block, and by performing intra-frame prediction based on the reference samples, the prediction accuracy of the current block can be improved, thereby improving the overall coding efficiency.

[0015] According to the present invention, weights of multiple neighboring samples can be derived, reference samples can be derived based on the weights and the neighboring samples, and intra prediction based on the reference samples can improve the prediction accuracy of the current block, thereby improving the overall coding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a schematic diagram illustrating a configuration of a video encoding device to which the present invention is applicable.

[0017] Figure 2 is a schematic diagram illustrating a configuration of a video decoding device to which the present invention is applicable.

[0018] Figure 3 Illustrated are left neighboring samples and upper neighboring samples used for intra prediction of a current block.

[0019] Figure 4 This figure illustrates an example of deriving a reference sample based on multiple neighboring samples of a current block.

[0020] Figure 5 This figure illustrates an example of deriving a reference sample based on multiple neighboring samples of a current block.

[0021] Figure 6 The diagram illustrates an example of generating an upper reference sample of a current block based on upper neighboring samples including additionally generated upper neighboring samples.

[0022] Figure 7 An example of deriving neighboring samples located at fractional sample positions is illustrated.

[0023] Figure 8 The diagram illustrates an example of generating an upper reference sample of a current block based on upper neighboring samples including additionally generated upper neighboring samples.

[0024] Figure 9 An example of dividing intra prediction modes according to prediction directions is illustrated.

[0025] Figure 10 The diagram illustrates an example of generating an upper reference sample of a current block based on upper neighboring samples including additionally generated upper neighboring samples.

[0026] Figure 11 A video encoding method by an encoding device according to the present invention is schematically illustrated.

[0027] Figure 12 A video decoding method by a decoding device according to the present invention is schematically illustrated. DETAILED DESCRIPTION

[0028] The present invention can be modified in various forms, and specific embodiments thereof will be described and illustrated in the accompanying drawings. However, the embodiments are not intended to limit the present invention. The terms used in the following description are only used to describe specific embodiments, but are not intended to limit the present invention. Singular expressions include plural expressions as long as they are clearly read in different ways. Terms such as "including" and "having" are intended to indicate the presence of features, numbers, steps, operations, elements, components, or combinations thereof used in the following description, and therefore should be understood not to exclude the possibility of the presence or addition of one or more different features, numbers, steps, operations, elements, components, or combinations thereof.

[0029] On the other hand, for the purpose of explaining different specific functions, the elements in the drawings described in the present invention are drawn independently, which does not mean that these elements are implemented by independent hardware or independent software. For example, two or more elements of an element can be combined to form a single element, or an element can be divided into multiple elements. Without departing from the concept of the present invention, embodiments in which elements are combined and / or divided belong to the present invention.

[0030] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. In addition, throughout the drawings, the same reference numerals are used to designate the same elements, and the same description of the same elements will be omitted.

[0031] In this specification, a picture generally refers to a unit representing an image at a specific time, and a slice is a unit constituting a part of a picture. A picture can be composed of multiple slices, and the terms picture and slice can be mixed with each other as needed.

[0032] A pixel or picture element may refer to the smallest unit that constitutes a picture (or image). In addition, "sample" may be used as a term corresponding to a pixel. A sample may generally represent a pixel or a pixel value, may represent only a pixel (pixel value) of a luma component, or may represent only a pixel (pixel value) of a chroma component.

[0033] A unit refers to a basic unit of image processing. The unit may include at least one of a specific region and information related to the region. Alternatively, the unit may be combined with terms such as block, region, etc. In a typical case, an M×N block may represent a set of samples or transform coefficients arranged in M ​​columns and N rows.

[0034] Figure 1 The structure of a video encoding apparatus to which the present invention is applicable is briefly illustrated.

[0035] refer to Figure 1 , the video encoding apparatus 100 may include a picture divider 105, a predictor 110, a subtractor 115, a transformer 120, a quantizer 125, a rearranger 130, an entropy encoder 135, a residual processor 140, an adder 150, a filter 155, and a memory 160. The residual processor 140 may include a dequantizer 141 and an inverse transformer 142.

[0036] The picture divider 105 may separate an input picture into at least one processing unit.

[0037] In the example, the processing unit may be referred to as a coding unit (CU). In this case, the coding unit may be recursively separated from the largest coding unit (LCU) according to a quadtree binary tree (QTBT) structure. For example, one coding unit may be separated into a plurality of coding units of a deeper depth based on a quadtree structure and / or a binary tree structure. In this case, for example, the quadtree structure may be applied first, and the binary tree structure may be applied later. Alternatively, the binary tree structure may be applied first. The coding process according to the present invention may be performed based on a final coding unit that is no longer separated further. In this case, depending on image characteristics, the largest coding unit may be used as the final coding unit based on coding efficiency, etc., or the coding unit may be recursively separated into coding units of a lower depth as needed and the coding unit with the optimal size may be used as the final coding unit. Here, the coding process may include processes such as prediction, transformation, and restoration, which will be described later.

[0038] In another example, a processing unit may include a coding unit (CU), a prediction unit (PU), or a transform unit (TU). A coding unit may be separated from a maximum coding unit (LCU) into coding units of greater depth according to a quadtree structure. In this case, depending on image characteristics, the maximum coding unit may be directly used as the final coding unit based on coding efficiency, etc., or the coding unit may be recursively separated into coding units of greater depth as needed, and the coding unit with the optimal size may be used as the final coding unit. When a minimum coding unit (SCU) is set, the coding unit may not be separated into coding units smaller than the minimum coding unit. Here, the final coding unit refers to a coding unit that is partitioned or separated into a prediction unit or a transform unit. A prediction unit is a unit partitioned from a coding unit and may be a unit for sample prediction. Here, a prediction unit may be divided into sub-blocks. A transform unit may be partitioned from a coding unit according to a quadtree structure and may be a unit for deriving transform coefficients and / or a unit for deriving residual signals from transform coefficients. Hereinafter, a coding unit may be referred to as a coding block (CB), a prediction unit may be referred to as a prediction block (PB), and a transform unit may be referred to as a transform block (TB). A prediction block or prediction unit may refer to a specific area in the form of a block in a picture and include an array of prediction samples. In addition, a transform block or transform unit may refer to a specific area in the form of a block in a picture and include an array of transform coefficients or residual samples.

[0039] The predictor 110 may perform prediction on a processing target block (hereinafter, a current block) and may generate a prediction block including prediction samples of the current block. The prediction unit performed in the predictor 110 may be a coding block, a transform block, or a prediction block.

[0040] The predictor 110 may determine whether to apply intra prediction or inter prediction to the current block. For example, the predictor 110 may determine whether to apply intra prediction or inter prediction in units of CUs.

[0041] In the case of intra prediction, the predictor 110 can derive prediction samples of the current block based on reference samples outside the current block in a picture to which the current block belongs (hereinafter, the current picture). In this case, the predictor 110 can derive prediction samples based on an average or interpolation of neighboring reference samples of the current block (case (i)), or can derive prediction samples based on reference samples existing in a specific (prediction) direction with respect to the prediction samples in the neighboring reference samples of the current block (case (ii)). Case (i) can be referred to as a non-directional mode or a non-angle mode, and case (ii) can be referred to as a directional mode or an angle mode. In intra prediction, the prediction mode may include, as an example, 33 directional modes and at least two non-directional modes. The non-directional mode may include a DC mode and a planar mode. The predictor 110 may determine the prediction mode to be applied to the current block by using the prediction mode applied to the neighboring block.

[0042] In the case of inter-frame prediction, the predictor 110 can derive the prediction sample of the current block based on the sample specified by the motion vector on the reference picture. The predictor 110 can derive the prediction sample of the current block by applying any one of the skip mode, merge mode, and motion vector prediction (MVP) mode. In the case of skip mode and merge mode, the predictor 110 can use the motion information of the neighboring block as the motion information of the current block. In the case of skip mode, unlike merge mode, the difference (residual) between the prediction sample and the original sample is not sent. In the case of MVP mode, the motion vector of the neighboring block is used as a motion vector predictor, and is therefore used as the motion vector predictor of the current block to derive the motion vector of the current block.

[0043] In the case of inter-frame prediction, the neighboring blocks may include spatial neighboring blocks present in the current picture and temporal neighboring blocks present in the reference picture. The reference picture including the temporal neighboring blocks may also be referred to as a collocated picture (colPic). Motion information may include a motion vector and a reference picture index. Information such as prediction mode information and motion information may be (entropy) encoded and then output as a bitstream.

[0044] When using motion information of temporally neighboring blocks in skip mode and merge mode, the highest picture in the reference picture list can be used as the reference picture. The reference pictures included in the reference picture list can be aligned based on the picture order count (POC) difference between the current picture and the corresponding reference picture. The POC corresponds to the display order and can be distinguished from the coding order.

[0045] The subtractor 115 generates a residual sample, which is a difference between the original sample and the predicted sample. If the skip mode is applied, the residual sample may not be generated as described above.

[0046] The transformer 120 transforms the residual samples in units of transform blocks to generate transform coefficients. The transformer 120 may perform the transform based on the size of the corresponding transform block and the prediction mode applied to the coding block or prediction block that spatially overlaps with the transform block. For example, if intra prediction is applied to the coding block or prediction block that overlaps with the transform block and the transform block is a 4×4 residual array, the residual samples may be transformed using a discrete sine transform (DST) transform kernel, and in other cases, the residual samples may be transformed using a discrete cosine transform (DCT) transform kernel.

[0047] The quantizer 125 may quantize the transform coefficients to generate quantized transform coefficients.

[0048] The rearranger 130 rearranges the quantized transform coefficients. The rearranger 130 may rearrange the quantized transform coefficients in block form into a one-dimensional vector by a coefficient scanning method. Although the rearranger 130 is described as a separate component, the rearranger 130 may be part of the quantizer 125.

[0049] The entropy encoder 135 may perform entropy encoding on the quantized transform coefficients. Entropy encoding may include encoding methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC). In addition to the quantized transform coefficients, the entropy encoder 135 may encode information required for video recovery (e.g., syntax element values, etc.) together or separately. The entropy coded information may be transmitted or stored in units of a Network Abstraction Layer (NAL) in the form of a bitstream.

[0050] The dequantizer 141 dequantizes the value (transform coefficient) quantized by the quantizer 125 , and the inverse transformer 142 inversely transforms the value dequantized by the dequantizer 141 to generate residual samples.

[0051] Adder 150 adds the residual samples to the prediction samples to reconstruct the picture. The residual samples can be added to the prediction samples in units of blocks to generate a restored block. Although adder 150 is described as a separate component, adder 150 can be part of predictor 110. At the same time, adder 150 can be referred to as a reconstructor or a restored block generator.

[0052] The filter 155 may apply deblocking filtering and / or sample adaptive offset to the restored picture. Deblocking filtering and / or sample adaptive offset may be used to correct artifacts at block boundaries or distortion in quantization in the restored picture. After deblocking filtering is completed, sample adaptive offset may be applied on a sample-by-sample basis. The filter 155 may apply an adaptive loop filter (ALF) to the restored picture. The ALF may be applied to the restored picture to which deblocking filtering and / or sample adaptive offset have been applied.

[0053] The memory 160 may store restored pictures (decoded pictures) or information required for encoding / decoding. Here, the restored pictures may be restored pictures filtered by the filter 155. The stored restored pictures may be used as reference pictures for (inter-frame) prediction of other pictures. For example, the memory 160 may store (reference) pictures used for inter-frame prediction. Here, pictures used for inter-frame prediction may be specified based on a reference picture set or a reference picture list.

[0054] Figure 2 The structure of a video decoding device to which the present invention is applicable is briefly illustrated.

[0055] refer to Figure 2 , the video decoding apparatus 200 may include an entropy decoder 210, a residual processor 220, a predictor 230, an adder 240, a filter 250, and a memory 260. The residual processor 220 may include a rearranger 221, a dequantizer 222, and an inverse transformer 223.

[0056] When a bitstream including video information is input, the video decoding apparatus 200 may reconstruct a video in association with a process of processing the video information in the video encoding apparatus.

[0057] For example, the video decoding apparatus 200 may perform video decoding using a processing unit used in a video encoding apparatus. Thus, a processing unit block for video decoding may be, for example, a coding unit, and in another example, may be a coding unit, a prediction unit, or a transform unit. Coding units may be separated from a maximum coding unit according to a quadtree structure and / or a binary tree structure.

[0058] In some cases, prediction units and transform units may be further used. In this case, a prediction block is a block derived or partitioned from a coding unit and may be a unit for sample prediction. Here, a prediction unit may be divided into sub-blocks. A transform unit may be separated from a coding unit according to a quadtree structure and may be a unit for deriving transform coefficients or a unit for deriving residual signals from transform coefficients.

[0059] The entropy decoder 210 can parse the bitstream to output information required for video restoration or picture restoration. For example, the entropy decoder 210 can decode the information in the bitstream based on a coding method such as exponential Golomb coding, CAVLC, CABAC, etc., and can output the values ​​of syntax elements required for video restoration and the quantized values ​​of the transform coefficients of the residual.

[0060] More specifically, the CABAC entropy decoding method can receive a binary (bin) corresponding to each syntax element in the bitstream, use the decoding target syntax element information and the decoding information of the adjacent and decoding target blocks or the information of the amabol / bin decoded in the previous step to determine the context model, predict the binary generation probability according to the determined context model, and perform arithmetic decoding of the binary to generate a symbol corresponding to each syntax element value. Here, the CABAC entropy decoding method can update the context model using the information of the symbol / bin decoded by the context model for the next symbol / bin after determining the context model.

[0061] Information about prediction among the information decoded in the entropy decoder 210 may be provided to the predictor 230 , and a residual value, ie, a quantized transform coefficient, which has been entropy-decoded by the entropy decoder 210 may be input to the rearranger 221 .

[0062] The rearranger 221 may rearrange the quantized transform coefficients into a two-dimensional block form. The rearranger 221 may perform rearrangement corresponding to the coefficient scanning performed by the encoding device. Although the rearranger 221 is described as a separate component, the rearranger 221 may be part of the dequantizer 222.

[0063] The dequantizer 222 may dequantize the quantized transform coefficient based on the (de)quantization parameter to output the transform coefficient. In this case, information for deriving the quantization parameter may be signaled from the encoding device.

[0064] The inverse transformer 223 may inversely transform the transform coefficients to derive residual samples.

[0065] The predictor 230 may perform prediction on the current block and may generate a prediction block including prediction samples of the current block. A unit of prediction performed in the predictor 230 may be a coding block, a transform block, or a prediction block.

[0066] The predictor 230 can determine whether to apply intra-frame prediction or inter-frame prediction based on the prediction information. In this case, the unit used to determine which one to use between intra-frame prediction and inter-frame prediction may be different from the unit used to generate prediction samples. In addition, the unit used to generate prediction samples may also be different for inter-frame prediction and intra-frame prediction. For example, it may be determined which one to use between inter-frame prediction and intra-frame prediction on a CU basis. In addition, for example, in inter-frame prediction, prediction samples may be generated by determining a prediction mode on a PU basis, and in intra-frame prediction, prediction samples may be generated on a TU basis by determining a prediction mode on a PU basis.

[0067] In the case of intra prediction, the predictor 230 can derive the prediction samples of the current block based on the neighboring reference samples in the current picture. The predictor 230 can derive the prediction samples of the current block by applying a directional mode or a non-directional mode based on the neighboring reference samples of the current block. In this case, the prediction mode to be applied to the current block can be determined by using the intra prediction mode of the neighboring block.

[0068] In the case of inter-frame prediction, the predictor 230 can derive the prediction sample of the current block based on the sample specified in the reference picture according to the motion vector. The predictor 230 can derive the prediction sample of the current block using one of the skip mode, merge mode, and MVP mode. Here, the motion information required for inter-frame prediction of the current block provided by the video encoding device, such as the motion vector and information about the reference picture index, can be obtained or derived based on the information about the prediction.

[0069] In skip mode and merge mode, motion information of a neighboring block may be used as motion information of the current block. Here, the neighboring block may include a spatial neighboring block and a temporal neighboring block.

[0070] The predictor 230 can use the motion information of available neighboring blocks to construct a merge candidate list and use the information indicated by the merge index on the merge candidate list as the motion vector of the current block. The merge index can be signaled by the encoding device. The motion information can include a motion vector and a reference picture. When using the motion information of temporally neighboring blocks in skip mode and merge mode, the highest picture in the reference picture list can be used as the reference picture.

[0071] In the case of skip mode, the difference (residual) between the predicted sample and the original sample is not sent, unlike the merge mode.

[0072] In the case of MVP mode, the motion vector of the current block can be derived using the motion vector of the neighboring block as a motion vector predictor. Here, the neighboring block may include a spatial neighboring block and a temporal neighboring block.

[0073] When the merge mode is applied, for example, the motion vectors of the restored spatially adjacent blocks and / or the motion vectors corresponding to the Col blocks as temporally adjacent blocks may be used to generate a merge candidate list. The motion vectors of the candidate blocks selected from the merge candidate list are used as the motion vectors of the current block in the merge mode. The above-mentioned information on prediction may include a merge index indicating the candidate block having the best motion vector selected from the candidate blocks included in the merge candidate list. Here, the predictor 230 may derive the motion vector of the current block using the merge index.

[0074] When the MVP (motion vector prediction) mode is applied as another example, the motion vectors of the restored spatially neighboring blocks and / or the motion vectors corresponding to the Col block, which is a temporally neighboring block, can be used to generate a motion vector predictor candidate list. That is, the motion vectors of the restored spatially neighboring blocks and / or the motion vectors corresponding to the Col block, which is a temporally neighboring block, can be used as motion vector candidates. The prediction information may include a predicted motion vector index indicating the best motion vector selected from the motion vector candidates included in the list. Here, the predictor 230 may use the motion vector index to select a predicted motion vector for the current block from the motion vector candidates included in the motion vector candidate list. The predictor of the encoding device may obtain a motion vector difference (MVD) between the motion vector of the current block and a motion vector predictor, encode the MVD, and output the encoded MVD in the form of a bitstream. That is, the MVD may be obtained by subtracting the motion vector predictor from the motion vector of the current block. Here, the predictor 230 may obtain the motion vector included in the prediction information and derive the motion vector of the current block by adding the motion vector difference to the motion vector predictor. Furthermore, the predictor may obtain or derive a reference picture index indicating a reference picture from the prediction information.

[0075] Adder 240 can add residual samples to prediction samples to reconstruct the current block or current picture. Adder 240 can reconstruct the current picture by adding residual samples to prediction samples in units of blocks. When skip mode is applied, no residual is transmitted, and thus the prediction samples can become recovery samples. Although adder 240 is described as a separate component, adder 240 can be part of predictor 230. At the same time, adder 240 can be referred to as a reconstructor or recovery block generator.

[0076] The filter 250 may apply deblocking filtering, sample adaptive offset, and / or ALF to restore the image. Here, sample adaptive offset may be applied in units of samples after deblocking filtering. ALF may be applied after deblocking filtering and / or applying sample adaptive offset.

[0077] The memory 260 can store restored pictures (decoded pictures) or information required for decoding. Here, the restored pictures can be restored pictures filtered by the filter 250. For example, the memory 260 can store pictures used for inter-frame prediction. Here, the pictures used for inter-frame prediction can be specified based on a reference picture set or a reference picture list. The restored pictures can be used as reference pictures for other pictures. The memory 260 can output the restored pictures in the output order.

[0078] As described above, when performing intra prediction of the current block, intra prediction can be performed based on neighboring samples that have been encoded / decoded at the decoding time point of the current block. That is, the prediction samples of the current block can be restored using the restored left neighboring samples and upper neighboring samples of the current block. Figure 3 The ones shown in represent the left neighboring samples and the upper neighboring samples.

[0079] Figure 3 The diagram illustrates left neighboring samples and upper neighboring samples used for intra prediction of the current block. When intra prediction is performed in the current block, the intra prediction mode of the current block can be derived, and at least one of the left neighboring samples and upper neighboring samples can be used to generate a predicted sample of the current block according to the intra prediction mode. Here, the intra prediction mode may include, for example, two non-directional intra prediction modes and 33 directional intra prediction modes. Here, the 0th and 1st intra prediction modes are non-directional intra prediction modes, the 0th intra prediction mode indicates an intra plane mode, and the 1st intra prediction mode indicates an intra DC mode. The remaining 2nd to 34th intra prediction modes are directional intra prediction modes, and each mode has a prediction direction. The directional intra prediction mode may be referred to as an intra angular mode. The predicted sample value of the current sample of the current block can be derived based on the intra prediction mode of the current block.

[0080] For example, when the intra prediction mode of the current block is one of the directional intra modes, the values ​​of neighboring samples positioned in the prediction direction of the intra prediction mode of the current block can be derived based on the current sample in the current block as the predicted sample value of the current sample. When the neighboring samples of the integer sample unit are not positioned in the prediction direction based on the current sample, the sample values ​​of the fractional sample unit at the corresponding prediction direction are derived by interpolating the neighboring samples of the integer sample unit positioned near the corresponding prediction direction, and the sample values ​​of the fractional sample unit can be derived as the predicted sample value of the current sample.

[0081] As described above, when at least one of the left neighboring samples and the upper neighboring samples is used to generate the prediction sample of the current block, the prediction accuracy may decrease as the distance between the prediction sample and the neighboring samples increases. In addition, because the prediction sample is generated with reference to only one row or one column of neighboring samples, when noise information is included in the samples adjacent to the current block, the prediction accuracy of the current block is greatly deteriorated, and thus the overall coding efficiency may be deteriorated. Therefore, the present invention proposes a method for generating reference samples based on multiple left neighboring samples and upper neighboring samples, that is, multiple columns of left neighboring samples and multiple rows of upper neighboring samples, and performing intra-frame prediction based on the generated reference samples to improve the prediction accuracy of intra-frame prediction and improve coding efficiency. In the following embodiment, a method of generating a left reference sample (or upper reference sample) based on four left neighboring samples (or upper neighboring samples) is described, but random n (N>1) left neighboring samples (or upper neighboring samples) can be used, and thus a left reference sample (or upper reference sample) can be generated.

[0082] Figure 4 The figure shows an example of deriving a reference sample based on multiple neighboring samples of the current block. Figure 4 When the size of the current block is N×N, 2N upper reference samples can be generated based on the upper neighboring samples in a 2N×4 area, and 2N left reference samples can be generated based on the left neighboring samples in a 4×2N area. Specifically, one upper reference sample located in a specific column can be generated based on the four upper neighboring samples located in a specific column among the upper neighboring samples, and one left reference sample located in a specific row can be generated based on the four left neighboring samples located in a specific row among the left neighboring samples. For example, the average value of the sample values ​​of the four upper neighboring samples located in the xth column among the upper neighboring samples can be derived as the sample value of the upper reference sample in the xth column. In addition, the average value of the sample values ​​of the four left neighboring samples located in the yth column among the left neighboring samples can be derived as the sample value of the left reference sample in the yth row.

[0083] As described above, the same weight {1 / 4, 1 / 4, 1 / 4, 1 / 4} can be assigned to the neighboring samples used to generate the reference sample, but in other words, the weight of the neighboring samples used to generate the reference sample can be the same as 1 / 4, but the prediction accuracy can be reduced in proportion to the distance between the neighboring samples and the current block to be encoded. Therefore, when the four upper neighboring samples are represented as the first row of upper neighboring samples, the second row of upper neighboring samples, the third row of upper neighboring samples, and the fourth row of upper neighboring samples from the bottom to the top, the weight of the first row of upper neighboring samples can be assigned to 1 / 2, the weight of the second row of upper neighboring samples can be assigned to 1 / 4, and the weight of the third row of upper neighboring samples and the fourth row of upper neighboring samples can be assigned to 1 / 8. Therefore, samples with a small distance from the current block among the upper neighboring samples can be used more frequently to generate the upper reference sample. In addition, when four left neighboring samples are represented as a first column of left neighboring samples, a second column of left neighboring samples, a third column of left neighboring samples, and a fourth column of left neighboring samples in a right-to-left direction, the weight of the first column of left neighboring samples may be assigned to 1 / 2, the weight of the second column of left neighboring samples may be assigned to 1 / 4, and the weights of the third column of left neighboring samples and the fourth column of left neighboring samples may be assigned to 1 / 8.

[0084] In another example, the weights of the neighboring samples on the first row and the second row may be assigned to 2 / 5, and the weights of the neighboring samples on the third row and the fourth row may be assigned to 1 / 10. In addition, the weights of the neighboring samples on the left of the first column may be assigned to 1 / 2, the weights of the neighboring samples on the left of the second column may be assigned to 1 / 4, and the weights of the neighboring samples on the left of the third column and the fourth column may be assigned to 1 / 8.

[0085] In addition, the method of assigning weights to each neighboring sample may include various methods other than the above examples. For example, the weight of each neighboring sample may be assigned according to the distance between each neighboring sample and the current block, the weight of each neighboring sample may be assigned according to the size of the current block, and the weight of each neighboring sample may be assigned according to the quantization parameter (QP) of the current block. In addition, the weight of each neighboring sample may be assigned based on various criteria. An upper reference sample may be derived based on the upper neighboring sample and the weight assigned to each upper neighboring sample. In addition, a left reference sample may be derived based on the left neighboring sample and the weight assigned to each left neighboring sample. In addition, an upper reference sample or a left reference sample may be derived based on the following equation.

[0086] [Equation 1]

[0087] D'=w1*D+w2*C+w3*B+w4*A

[0088] Wherein D' may represent the upper reference sample (or the left reference sample), w1 may represent the weight of the upper neighboring sample in the first row (or the left neighboring sample in the first column), w2 may represent the weight of the upper neighboring sample in the second row (or the left neighboring sample in the second column), w3 may represent the weight of the upper neighboring sample in the third row (or the left neighboring sample in the third column), and w4 may represent the weight of the upper neighboring sample in the fourth row (or the left neighboring sample in the fourth column). In addition, D may represent the upper neighboring sample in the first row (or the left neighboring sample in the first column), C may represent the upper neighboring sample in the second row (or the left neighboring sample in the second column), B may represent the upper neighboring sample in the third row (or the left neighboring sample in the third column), and A may represent the upper neighboring sample in the fourth row (or the left neighboring sample in the fourth column).

[0089] As described above, the reference sample of the current block may be derived based on 2N neighboring samples of multiple columns or rows, but the reference sample may be derived based on neighboring samples exceeding 2N neighboring samples of multiple rows or columns according to the prediction direction of the current block.

[0090] Figure 5 The figure shows an example of deriving a reference sample based on multiple neighboring samples of the current block. Figure 5 , the intra prediction mode of the current block can be derived, and the prediction direction according to the intra prediction mode can be derived. The reference sample of the current block can be generated based on the neighboring samples positioned in the prediction direction. In this case, Figure 5 As shown in , the prediction direction of the current block can point from the upper right side to the lower left side and is positioned at Figure 5 The upper neighboring samples in the additional area 510 shown in FIG. 5 may be needed to predict the current block. In other words, L upper neighboring samples and 2N upper neighboring samples located in the first row may be needed to predict the current block. Furthermore, M upper neighboring samples and 2N upper neighboring samples located in the fourth row may be needed to predict the current block. Therefore, neighboring samples located in the additional area 510 can be generated, and reference samples for the current block can be generated based on neighboring samples located in the prediction direction of the current block including the neighboring samples in the additional area 510. The samples located in the additional area 510 can be generated by padding the sample value of the upper-rightmost neighboring sample in each row of upper neighboring samples. In other words, the sample value of the samples located in the additional area 510 can be derived to be equal to the sample value of the upper-rightmost neighboring sample in each row of upper neighboring samples. Although the example of generating samples located in the additional area of ​​left neighboring samples is not shown in the figure, similar to the example of generating samples located in the additional area 510, samples located in the additional area of ​​left neighboring samples can be generated. Specifically, samples positioned in the additional region of the left-neighboring samples may be generated by filling in the sample value of the lowest left-neighboring sample among the left-neighboring samples of each column.

[0091] When the upper neighboring samples including the upper neighboring samples of the additional area 510 are derived, the upper reference samples of the current block may be generated based on the upper neighboring samples. An embodiment of generating the upper reference samples may be shown in the following figure.

[0092] Figure 6 The diagram illustrates an example of generating an upper reference sample of a current block based on upper neighboring samples including additionally generated upper neighboring samples. Figure 6 (b) illustrates the position of the newly generated upper reference sample. In this case, at the position of the upper reference sample 610, the upper neighboring sample at the position corresponding to the prediction direction of the current block can be used to generate the upper reference sample 610. For example, Figure 6 As shown in (a), at the position of the upper reference sample 610, upper neighboring samples A, B, C, and D, which are upper neighboring samples at a position corresponding to the prediction direction of the current block, can be used to generate the upper reference sample 610. When all positions of the upper neighboring samples A, B, C, and D are integer sample positions, that is, when all upper neighboring samples A, B, C, and D are integer samples, the upper reference sample 610 can be generated based on the sample values ​​of the upper neighboring samples A, B, C, and D. Similarly, the left neighboring sample positioned in the prediction direction of the current block can be derived based on the position of the left reference sample, and the left reference sample can be generated based on the left neighboring samples.

[0093] When there are positions other than integer sample positions among the positions of upper neighboring sample A, upper neighboring sample B, upper neighboring sample C, and upper neighboring sample D, that is, when there are fractional samples of upper neighboring sample A, upper neighboring sample B, upper neighboring sample C, and upper neighboring sample D, the fractional samples can be derived as shown in the following figure.

[0094] Figure 7 An example of deriving neighboring samples located at fractional sample positions is shown. Figure 7 , the sample value of the neighboring sample X, which is a fractional sample, can be generated by linearly interpolating the sample values ​​of the integer samples D1 and D2 adjacent to the left and right of the neighboring sample. That is, when the upper neighboring sample A, the upper neighboring sample B, the upper neighboring sample C, or the upper neighboring sample D is a fractional sample, the fractional sample can be derived based on the upper neighboring sample at the integer sample position adjacent to the fractional sample. The fractional sample can be derived based on the following equation.

[0095] [Equation 2]

[0096] X=(D1*d1+D2*d2+(d1+d2) / 2) / (d1+d2)

[0097] Wherein X may represent a fractional sample, D1 may represent an integer sample adjacent to the left of the fractional sample, D2 may represent an integer sample adjacent to the right of the fractional sample, d1 may represent a distance between D2 and X, and d2 may represent a distance between D1 and X.

[0098] The value of each upper neighboring sample used to generate the upper reference sample can be derived by the above method. When the upper neighboring samples of integer sample positions or fractional sample positions are derived, the upper reference sample can be generated based on the upper neighboring samples. The upper reference sample can be generated by assigning the same weight to each upper reference sample as described above. Alternatively, the weight of each upper reference sample can be assigned considering the distance between the current block and each upper reference sample, and the upper reference sample can be generated based on each upper reference sample and the weight. Alternatively, the weight of each upper reference sample can be assigned based on various criteria such as the QP or size of the current block, and the upper reference sample can be generated based on each upper reference sample and the weight. In addition, the upper reference sample can be generated by replacing the upper neighboring sample and the weight assigned to each upper neighboring sample in Equation 1. In addition, when there are fractional samples in the left neighboring samples, the fractional samples can be derived, similar to the above description, and the left reference sample can be derived based on the fractional samples.

[0099] When generating reference samples based on neighboring samples positioned in the prediction direction of the current block, the same weight {1 / 4, 1 / 4, 1 / 4, 1 / 4} can be assigned to the neighboring samples used to generate the reference samples, or the weight of each neighboring sample can be assigned according to the distance between each neighboring sample and the current block, as described above. Alternatively, the weight of each neighboring sample can be assigned according to the size of the current block or the quantization parameter (QP) of the current block. In addition, the weight of each neighboring sample can be assigned based on various criteria. The upper reference sample can be derived based on the upper neighboring sample and the weight assigned to each upper neighboring sample. In addition, the left reference sample can be derived based on the left neighboring sample and the weight assigned to each left neighboring sample.

[0100] As described above, when reference samples are derived based on 2N neighboring samples of multiple columns or rows and neighboring samples included in the additional area according to the prediction direction of the current block, samples positioned in the additional area can be generated by padding as described above, but when the neighboring samples positioned in the additional area have been restored, the restored neighboring samples of the additional area can be used, and when the neighboring samples positioned in the additional area are not restored, the neighboring samples can be generated by the above-mentioned padding.

[0101] Figure 8The diagram shows an example of generating an upper reference sample of the current block based on an upper neighboring sample including an additionally generated upper neighboring sample. As described above, the intra prediction mode of the current block can be derived, and the reference sample of the current block can be generated based on the neighboring samples positioned in the prediction direction. In this case, as Figure 8 As shown in (a), the prediction direction of the current block can be directed from the upper right side to the lower left side, and is positioned as shown in FIG. Figure 8 The upper neighboring samples in the additional area 810 shown in (a) may be needed to predict the current block. When the upper neighboring samples included in the additional area 810 have been restored, the restored upper neighboring samples can be used to generate the upper reference samples. Figure 8 As shown in (b), when the upper neighboring samples located in the additional area 820 are not restored, the samples located in the additional area 820 can be generated by filling the sample value of the rightmost upper neighboring sample in each row of upper neighboring samples. That is, the sample value of the sample located in the additional area 820 can be derived to be equal to the sample value of the rightmost upper neighboring sample in each row of upper neighboring samples. Although the additional area of ​​left neighboring samples is not shown in the figure, similar to the method of deriving the upper neighboring samples included in the additional area 810, the left neighboring samples included in the additional area of ​​left neighboring samples can be derived.

[0102] The embodiment for generating the above-mentioned reference samples may be selected based on the prediction direction of the current block. In other words, the reference samples of the current block may be generated by other methods according to the intra prediction mode.

[0103] Figure 9 This figure shows an example of dividing intra prediction modes according to prediction directions. Figure 9 , the intra prediction mode can be divided into four areas according to the prediction direction. Figure 9 , the intra prediction mode may be included in region A, region B, region C, or region D according to a prediction direction. Specifically, for example, 2nd to 9th intra prediction modes of the intra prediction mode may be included in region A, 10th to 17th intra prediction modes may be included in region B, 18th to 26th intra prediction modes may be included in region C, and 27th to 34th intra prediction modes may be included in region D. A method of deriving a reference sample of a current block based on the intra prediction mode applied to the current block may be determined.

[0104] For example, when the intra prediction mode included in region D is applied to the current block, Figure 8The method shown in derives the reference samples of the current block. In other words, 2N upper neighboring samples of multiple rows of the current block and upper neighboring samples of the additional area can be generated, and at the position of the upper reference sample of the current block in the 2N upper neighboring samples of the multiple rows and the upper neighboring samples of the additional area, the upper reference sample of the current block can be generated based on the neighboring samples positioned in the prediction direction. When the upper neighboring samples of the additional area have been restored, the restored upper neighboring samples can be used to generate the reference samples of the current block, and when the upper neighboring samples of the additional area have not been restored, the upper neighboring samples can be generated by filling the sample value of the rightmost upper neighboring sample in the 2N upper neighboring samples of each row.

[0105] As another example, when the intra prediction mode included in the region C is applied to the current block, a reference sample of the current block may be generated as follows: Figure 10 As shown in .

[0106] Figure 10 The figure shows an example of generating an upper reference sample of the current block based on upper neighboring samples including additionally generated upper neighboring samples. Figure 10 When the upper reference sample D' shown in (b) is generated, it can be Figure 10 D' is generated based on the upper neighboring samples A, B, C, and D at a position corresponding to the prediction direction of the current block at the position of D' shown in (a). When all the positions of the upper neighboring samples A, B, C, and D are integer sample positions, that is, when A, B, C, and D are all integer samples, D' can be generated based on the sample values ​​of A, B, C, and D. When there are samples of fractional sample positions among the positions of the upper neighboring samples A, B, C, and D, that is, when there are fractional samples in A, B, C, and D, the sample values ​​of the integer samples adjacent to the left and right of the fractional samples can be generated by linear interpolation, and D' can be generated based on the generated fractional samples, as described above. In addition, in Figure 10 At the position of H' shown in (b), H' can be generated based on the upper neighboring samples E, F, G, and H at a position corresponding to the prediction direction of the current block. When all the positions of the upper neighboring samples E, F, G, and H are integer sample positions, that is, when H, F, G, and H are all integer samples, H' can be generated based on the sample values ​​of E, F, G, and H. When there are samples of fractional sample positions among the positions of the upper neighboring samples E, F, G, and H, that is, when there are fractional samples among E, F, G, and H, sample values ​​of integer samples adjacent to the left and right of the fractional samples can be generated by linear interpolation, and H' can be generated based on the generated fractional samples as described above.

[0107] When the intra prediction mode included in region B is applied to the current block and when the intra prediction mode included in region C is applied to the current block, the reference sample of the current block may be generated by the same method as the method of deriving the reference sample of the current block. In addition, when the intra prediction mode included in region A is applied to the current block and when the intra prediction mode included in region D is applied to the current block, the reference sample of the current block may be generated by the same method as the method of deriving the reference sample of the current block.

[0108] Figure 11 A video encoding method by an encoding device according to the present invention is schematically illustrated. Figure 11 The method disclosed in Figure 1 Specifically, for example, Figure 11 S1100 to S1140 may be performed by a prediction unit of the encoding apparatus, and S1150 may be performed by an entropy encoding unit of the encoding apparatus.

[0109] The encoding device determines an intra prediction mode for the current block (S1100). The encoding device may perform various intra prediction modes to derive an intra prediction mode with an optimal RD cost as the intra prediction mode for the current block. The intra prediction mode may be one of two non-directional prediction modes and 33 directional prediction modes. As described above, the two non-directional prediction modes may include an intra DC mode and an intra planar mode.

[0110] The encoding device derives multiple rows of upper neighboring samples and multiple columns of left neighboring samples of the current block (S1110). The encoding device may derive multiple rows of upper neighboring samples of the current block. For example, the encoding device may derive four rows of upper neighboring samples of the current block. Furthermore, for example, when the size of the current block is N×N, the encoding device may derive 2N upper neighboring samples in each of the multiple rows. The 2N upper neighboring samples of each row may be referred to as first upper neighboring samples.

[0111] The upper reference sample can be derived based on a specific upper neighboring sample derived based on the position of the upper reference sample and the prediction direction of the intra prediction mode of the current block, as described later. In this case, the upper neighboring samples other than the first upper neighboring sample can be used to derive the upper reference sample according to the prediction direction of the current block.

[0112] For example, when the size of the current block is N×N, the number of upper neighboring samples of the nth row among the multiple rows of upper neighboring samples may be greater than 2N. As another example, when the nth row is the first row, the number of upper neighboring samples of the nth row is 2N, and the number of upper neighboring samples of the (n+1)th row may be greater than 2N. In addition, the number of upper neighboring samples of the nth row among the multiple rows of upper neighboring samples of the current block may be less than the number of upper neighboring samples of the (n+1)th row. Specifically, the number of upper neighboring samples of the (n+1)th row may be greater than 2N, and the upper neighboring samples after the 2Nth upper neighboring sample of the upper neighboring samples of the (n+1)th row may be derived by padding the 2Nth upper neighboring sample of the upper neighboring samples of the (n+1)th row. Alternatively, before generating the prediction samples of the current block, when generating the reconstructed samples corresponding to the upper neighboring samples after the 2Nth upper neighboring sample of the upper neighboring samples of the (n+1)th row, the reconstructed samples may be described as the upper neighboring samples after the 2Nth upper neighboring sample.

[0113] As another example, when the size of the current block is N×N, the encoding device may derive the second upper neighboring samples of each row based on the prediction direction of the current block. Here, the second upper neighboring samples may represent upper neighboring samples other than the first upper neighboring samples of each row. The number of second upper neighboring samples of each row may be determined based on the prediction direction. The second upper neighboring samples of each row may be derived by filling the second upper neighboring samples positioned at the rightmost position among the first upper neighboring samples of each row. Alternatively, before generating the prediction samples of the current block, when reconstructed samples of the second upper neighboring samples are generated, the reconstructed samples may be derived as the second upper neighboring samples, and before generating the prediction samples of the current block, when reconstructed samples of the second upper neighboring samples are not generated, the second upper neighboring samples of each row may be derived by filling the second upper neighboring samples positioned at the rightmost position among the first upper neighboring samples of each row.

[0114] Furthermore, in another example, the encoding device may derive multiple columns of left-neighboring samples for the current block. For example, the encoding device may derive four columns of left-neighboring samples for the current block. Furthermore, for example, when the size of the current block is N×N, the encoding device may derive 2N left-neighboring samples in each of the multiple columns. The 2N left-neighboring samples in each column may be referred to as first left-neighboring samples.

[0115] The left reference sample may be derived based on a specific left neighboring sample derived based on the position of the left reference sample and the prediction direction of the intra prediction mode of the current block, as described later. In this case, left neighboring samples other than the first left neighboring sample may be used to derive the left reference sample according to the prediction direction of the current block.

[0116] For example, when the size of the current block is NxN, the number of left-neighboring samples in the nth column among the multiple columns of left-neighboring samples may be greater than 2N. In another example, when the nth column is the first column, the number of left-neighboring samples in the nth column is 2N, and the number of left-neighboring samples in the (n+1)th column may be greater than 2N. Furthermore, the number of left-neighboring samples in the nth column among the multiple columns of left-neighboring samples of the current block may be less than the number of left-neighboring samples in the (n+1)th column. Specifically, the number of left-neighboring samples in the (n+1)th column may be greater than 2N, and left-neighboring samples after the 2Nth left-neighboring sample in the (n+1)th column of left-neighboring samples may be derived by padding the 2Nth left-neighboring samples in the (n+1)th column of left-neighboring samples. Alternatively, before generating the predicted samples of the current block, when generating reconstructed samples corresponding to left-neighboring samples after the 2Nth left-neighboring sample in the (n+1)th column of left-neighboring samples, the reconstructed samples may be derived as left-neighboring samples after the 2Nth left-neighboring sample.

[0117] As another example, when the size of the current block is N×N, the encoding device may derive the second left neighboring samples of each column based on the prediction direction of the current block. Here, the second left neighboring samples may represent left neighboring samples other than the first left neighboring samples of each row. The number of second left neighboring samples of each column may be determined based on the prediction direction. The second left neighboring samples of each column may be derived by filling the second left neighboring samples positioned at the bottom of the first left neighboring samples of each column. Alternatively, before generating the prediction samples of the current block, when reconstructed samples of the second left neighboring samples are generated, the reconstructed samples may be derived as the second left neighboring samples, and before generating the prediction samples of the current block, when reconstructed samples of the second left neighboring samples are not generated, the second left neighboring samples of each column may be derived by filling the second left neighboring samples positioned at the bottom of the first left neighboring samples of each column.

[0118] The encoding apparatus derives a row of upper reference samples based on upper neighboring samples (S1120). The encoding apparatus may derive a row of upper reference samples based on a plurality of upper neighboring sample rows.

[0119] For example, an upper reference sample positioned in the xth column among the upper reference samples may be derived based on the upper neighboring sample positioned in the xth column among the upper neighboring samples. In this case, the average of the sample values ​​of the upper neighboring samples positioned in the xth column may be derived as the sample value of the upper reference sample positioned in the xth column. Furthermore, a weight of the upper neighboring sample positioned in the xth column may be derived, and the upper reference sample positioned in the xth column may be derived based on the weight and the upper neighboring sample positioned in the xth column. When deriving the weight of the upper neighboring sample positioned in the xth column, the upper reference sample may be derived based on Equation 1.

[0120] For example, the weight can be derived based on the distance between the upper neighboring sample and the upper reference sample positioned in the xth column. That is, the weight of the corresponding upper neighboring sample among the upper neighboring samples positioned in the xth column can be derived based on the distance between the corresponding upper neighboring sample and the upper reference sample, and for example, the weight of the corresponding upper neighboring sample can be inversely proportional to the distance between the corresponding upper neighboring sample and the upper reference sample. Specifically, when deriving four rows of upper neighboring samples, the weights of the upper neighboring samples can be derived as 1 / 2, 1 / 4, 1 / 8, and 1 / 8 in order from bottom to top. Alternatively, the weights of the upper neighboring samples can be derived as 2 / 5, 2 / 5, 1 / 10, and 1 / 10 in order from bottom to top.

[0121] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0122] As another example, the first upper reference sample among the upper reference samples can be derived based on a specific upper neighboring sample derived based on the position of the first upper reference sample and the prediction direction of the current block. Specifically, the specific upper neighboring sample positioned in the prediction direction of the current block can be derived based on the position of the upper reference sample, and the upper reference sample can be derived based on the specific upper neighboring sample. In this case, the average of the sample values ​​of the specific upper neighboring samples can be derived as the sample value of the first upper reference sample. In addition, weights of the specific upper neighboring samples can be derived, and the first upper reference sample can be derived based on these weights and the specific upper neighboring samples. When the weights of the specific upper neighboring samples are derived, the first upper reference sample can be derived based on Equation 1.

[0123] For example, the weight may be derived based on the distance between the specific upper neighboring sample and the first upper reference sample. That is, the weight of the corresponding specific upper neighboring sample among the specific upper neighboring samples may be derived based on the distance between the corresponding specific upper neighboring sample and the first upper reference sample, and, for example, the weight of the corresponding specific upper neighboring sample may be inversely proportional to the distance between the corresponding specific upper neighboring sample and the first upper reference sample.

[0124] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0125] When the specific upper neighboring sample derived based on the prediction direction of the current block includes an upper neighboring sample that is a fractional sample, the sample value of the upper neighboring sample that is the fractional sample can be derived by linear interpolation between the sample values ​​of the integer samples adjacent to the left and right sides of the upper neighboring sample that is the fractional sample. For example, the sample value of the upper neighboring sample that is the fractional sample can be derived based on Equation 2.

[0126] A method for deriving an upper reference sample based on the intra prediction mode of the current block may be determined. For example, when the intra prediction mode of the current block is a mode having a prediction angle greater than the prediction angle of the vertical mode, that is, when the intra prediction mode of the current block is one of the 27th to 34th intra prediction modes, the corresponding upper reference sample of the upper reference sample may be derived based on a specific upper neighboring sample positioned in the prediction direction of the current block, based on the position of the corresponding upper reference sample. Here, the vertical mode may correspond to the 26th intra prediction mode. Furthermore, when the intra prediction mode of the current block is a mode having a prediction angle less than or equal to the prediction angle of the vertical mode, that is, when the intra prediction mode of the current block is one of the 18th to 26th intra prediction modes, the corresponding upper reference sample of the upper reference sample may be derived based on an upper neighboring sample positioned in the same column as the column of the corresponding upper reference sample.

[0127] The encoding apparatus derives a row of left reference samples based on the left neighboring samples ( S1130 ).The encoding apparatus may derive a column of left reference samples based on a plurality of columns of left neighboring samples.

[0128] For example, a left reference sample located in the yth row of left reference samples may be derived based on a left neighboring sample located in the yth row of left neighboring samples. In this case, the average of the sample values ​​of the left neighboring samples located in the yth row may be derived as the sample value of the left reference sample located in the yth row. Furthermore, a weight of the left neighboring sample located in the yth row may be derived, and the left reference sample located in the yth row may be derived based on the weight and the left neighboring sample located in the yth row. When the weight of the left neighboring sample located in the yth row is derived, the left reference sample may be derived based on Equation 1.

[0129] For example, the weight can be derived based on the distance between the left neighboring sample positioned in the yth row and the left reference sample. That is, the weight of the corresponding left neighboring sample among the left neighboring samples positioned in the yth row can be derived based on the distance between the corresponding left neighboring sample and the left reference sample, and for example, the weight of the corresponding left neighboring sample can be inversely proportional to the distance between the corresponding left neighboring sample and the left reference sample. Specifically, when deriving four columns of left neighboring samples, the weights of the left neighboring samples can be derived as 1 / 2, 1 / 4, 1 / 8, and 1 / 8 in order from right to left. Alternatively, the weights of the left neighboring samples can be derived as 2 / 5, 2 / 5, 1 / 10, and 1 / 10 in order from right to left.

[0130] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0131] As another example, a first left reference sample of a left reference sample can be derived based on a specific left neighboring sample derived based on the position of the first left reference sample and the prediction direction of the current block. Specifically, a specific left neighboring sample positioned in the prediction direction of the current block can be derived based on the position of the left reference sample, and the left reference sample can be derived based on the specific left neighboring sample. In this case, an average of the sample values ​​of the specific left neighboring samples can be derived as the sample value of the first left reference sample. Furthermore, a weight for the specific left neighboring sample can be derived, and the first left reference sample can be derived based on the weight and the specific left neighboring sample. When the weight for the specific left neighboring sample is derived, the first left reference sample can be derived based on Equation 1.

[0132] For example, the weight may be derived based on the distance between the specific left neighboring sample and the first left reference sample. That is, the weight of the corresponding specific left neighboring sample among the specific left neighboring samples may be derived based on the distance between the corresponding specific left neighboring sample and the first left reference sample, and, for example, the weight of the corresponding specific left neighboring sample may be inversely proportional to the distance between the corresponding specific left neighboring sample and the first left reference sample.

[0133] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0134] When the specific left neighboring sample derived based on the prediction direction of the current block includes a left neighboring sample that is a fractional sample, the sample value of the left neighboring sample that is the fractional sample can be derived by linear interpolation between the sample values ​​of the integer samples adjacent to the left and right sides of the left neighboring sample that is the fractional sample. For example, the sample value of the left neighboring sample that is the fractional sample can be derived based on Equation 2.

[0135] A method for deriving a left reference sample based on the intra prediction mode of the current block may be determined. For example, when the intra prediction mode of the current block is a mode having a prediction angle greater than the prediction angle of the horizontal mode, that is, when the intra prediction mode of the current block is one of the 2nd to 9th intra prediction modes, the corresponding left reference sample of the left reference sample may be derived based on a specific left neighboring sample positioned in the prediction direction of the current block, based on the position of the corresponding left reference sample. Here, the horizontal mode may correspond to the 10th intra prediction mode. Furthermore, when the intra prediction mode of the current block is a mode having a prediction angle less than or equal to the horizontal mode, that is, when the intra prediction mode of the current block is one of the 10th to 17th intra prediction modes, the corresponding left reference sample of the left reference sample may be derived based on a left neighboring sample positioned in the same row as the row of the corresponding left reference sample.

[0136] The encoding device generates a prediction sample of the current block using at least one of an upper reference sample and a left reference sample according to the intra prediction mode (S1140). The encoding device may generate the prediction sample based on the upper reference sample or the left reference sample located in the prediction direction of the intra prediction mode based on the position of the prediction sample.

[0137] The encoding device generates, encodes, and outputs prediction information for the current block (S1150). The encoding device may encode information about the intra-frame prediction mode of the current block and output the encoded information in the form of a bitstream. The encoding device may generate information about the intra-frame prediction mode representing the intra-frame prediction mode, and encode the generated information to output the encoded information in the form of a bitstream. The information about the intra-frame prediction mode may include information directly indicating the intra-frame prediction mode of the current block, or may include information indicating any candidate in the intra-frame prediction mode candidate list derived based on the intra-frame prediction mode of the left block or the upper block of the current block.

[0138] Figure 12 A video decoding method by a decoding device according to the present invention is schematically illustrated. Figure 12 The method disclosed in Figure 12 Specifically, for example, Figure 12 S1200 to S1240 may be performed by a prediction unit of the decoding device.

[0139] The decoding device derives the intra prediction mode of the current block (S1200). The decoding device may obtain prediction information about the current block through the bitstream. The prediction information may include information directly indicating the intra prediction mode of the current block or information indicating any candidate in the intra prediction mode candidate list derived based on the intra prediction mode of the left block or the upper block of the current block. The decoding device may derive the intra prediction mode of the current block based on the obtained prediction information. The intra prediction mode may be one of two non-directional prediction modes and 33 directional prediction modes. As described above, the two non-directional prediction modes may include an intra DC mode and an intra planar mode.

[0140] The decoding device derives multiple rows of upper neighboring samples and multiple columns of left neighboring samples for the current block (S1210). The decoding device may derive multiple rows of upper neighboring samples for the current block. For example, the decoding device may derive four rows of upper neighboring samples for the current block. Furthermore, for example, when the size of the current block is NxN, the decoding device may derive 2N upper neighboring samples for each of the multiple rows. The 2N upper neighboring samples for each row may be referred to as first upper neighboring samples.

[0141] The upper reference sample may be derived based on a specific upper neighboring sample derived based on the position of the upper reference sample of the current block and the prediction direction of the intra prediction mode of the current block, as described later. In this case, upper neighboring samples other than the first upper neighboring sample may be used to derive the upper reference sample according to the prediction direction of the current block.

[0142] For example, when the size of the current block is NxN, the number of upper neighboring samples in the nth row among the multiple rows of upper neighboring samples may be greater than 2N. As another example, when the nth row is the first row, the number of upper neighboring samples in the nth row is 2N, and the number of upper neighboring samples in the (n+1)th row may be greater than 2N. Furthermore, the number of upper neighboring samples in the nth row among the multiple rows of upper neighboring samples of the current block may be less than the number of upper neighboring samples in the (n+1)th row. Specifically, the number of upper neighboring samples in the (n+1)th row may be greater than 2N, and the upper neighboring samples after the 2Nth upper neighboring sample in the upper neighboring samples of the (n+1)th row may be derived by padding the 2Nth upper neighboring sample in the upper neighboring samples of the (n+1)th row. Alternatively, before generating the prediction samples of the current block, when generating the reconstructed samples corresponding to the upper neighboring samples after the 2Nth upper neighboring sample in the upper neighboring samples of the (n+1)th row, the reconstructed samples may be derived as the upper neighboring samples after the 2Nth upper neighboring sample.

[0143] As another example, when the size of the current block is NxN, the decoding device may derive the second upper neighboring samples of each row based on the prediction direction of the current block. Here, the second upper neighboring samples may represent the upper neighboring samples of each row excluding the first upper neighboring samples. The number of second upper neighboring samples of each row may be determined based on the prediction direction. The second upper neighboring samples of each row may be derived by filling the first upper neighboring samples positioned at the rightmost position among the first upper neighboring samples of each row. Alternatively, before generating the prediction samples of the current block, when reconstructed samples of the second upper neighboring samples are generated, the reconstructed samples may be derived as the second upper neighboring samples, and before generating the prediction samples of the current block, when reconstructed samples of the second upper neighboring samples are not generated, the second upper neighboring samples of each row may be derived by filling the first upper neighboring samples positioned at the rightmost position among the first upper neighboring samples of each row.

[0144] In another example, the decoding device may derive multiple columns of left-neighboring samples for the current block. For example, the decoding device may derive four columns of left-neighboring samples for the current block. Furthermore, for example, when the size of the current block is NxN, the decoding device may derive 2N left-neighboring samples for each of the multiple columns. The 2N left-neighboring samples for each column may be referred to as first left-neighboring samples.

[0145] The left reference sample may be derived based on a specific left neighboring sample derived based on the position of the left reference sample of the current block and the prediction direction of the intra prediction mode of the current block, as described later. In this case, left neighboring samples other than the first left neighboring sample may be used to derive the left reference sample according to the prediction direction of the current block.

[0146] For example, when the size of the current block is NxN, the number of left-neighboring samples in the nth column among the multiple columns of left-neighboring samples may be greater than 2N. In another example, when the nth column is the first column, the number of left-neighboring samples in the nth column is 2N, and the number of left-neighboring samples in the (n+1)th column may be greater than 2N. Furthermore, the number of left-neighboring samples in the nth column among the multiple columns of left-neighboring samples of the current block may be less than the number of left-neighboring samples in the (n+1)th column. Specifically, the number of left-neighboring samples in the (n+1)th column may be greater than 2N, and the left-neighboring samples after the 2Nth left-neighboring sample in the (n+1)th column of left-neighboring samples may be derived by padding the left-neighboring samples after the 2Nth left-neighboring sample in the (n+1)th column of left-neighboring samples. Alternatively, before generating the predicted samples of the current block, when generating reconstructed samples corresponding to the left-neighboring samples after the 2Nth left-neighboring sample in the (n+1)th column of left-neighboring samples, the reconstructed samples may be derived to the left-neighboring samples after the 2Nth left-neighboring sample.

[0147] As another example, when the size of the current block is NxN, the decoding device may derive the second left neighboring samples of each column based on the prediction direction of the current block. The number of second left neighboring samples of each column may be determined based on the prediction direction. The second left neighboring samples of each column may be derived by filling in the first left neighboring samples located at the bottom of each column. Alternatively, before generating the prediction samples of the current block, when reconstructed samples of the second left neighboring samples are generated, the reconstructed samples may be derived from the second left neighboring samples. And before generating the prediction samples of the current block, when reconstructed samples of the second left neighboring samples are not generated, the second left neighboring samples of each column may be derived by filling in the first left neighboring samples located at the bottom of each column.

[0148] The decoding apparatus derives a line of upper reference samples based on upper neighboring samples (S1220). The decoding apparatus may derive a line of upper reference samples based on multiple lines of upper neighboring samples.

[0149] For example, an upper reference sample positioned in column x among the upper reference samples may be derived based on an upper neighboring sample positioned in column x among the upper neighboring samples. In this case, the average of the sample values ​​of the upper neighboring samples positioned in column x may be derived as the sample value of the upper reference sample positioned in column x. Furthermore, a weight of the upper neighboring sample positioned in column x may be derived, and the upper reference sample positioned in column x may be derived based on the weight and the upper neighboring sample positioned in column x. When deriving the weight of the upper neighboring sample positioned in column x, the upper reference sample may be derived based on Equation 1.

[0150] For example, the weight can be derived based on the distance between the upper neighboring sample positioned in the xth column and the upper reference sample. That is, the weight of the corresponding upper neighboring sample among the upper neighboring samples positioned in the xth column can be derived based on the distance between the corresponding upper neighboring sample and the upper reference sample, and for example, the weight of the corresponding upper neighboring sample can be inversely proportional to the distance between the corresponding upper neighboring sample and the upper reference sample. Specifically, when deriving four rows of upper neighboring samples, the weights of the upper neighboring samples can be derived as 1 / 2, 1 / 4, 1 / 8, and 1 / 8 in order from bottom to top. Alternatively, the weights of the upper neighboring samples can be derived as 2 / 5, 2 / 5, 1 / 10, and 1 / 10 in order from bottom to top.

[0151] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0152] As another example, the first upper reference sample among the upper reference samples can be derived based on a specific upper neighboring sample derived based on the position of the first upper reference sample of the current block and the prediction direction of the current block. Specifically, the specific upper neighboring sample positioned in the prediction direction of the current block can be derived based on the position of the upper reference sample, and the upper reference sample can be derived based on the specific upper neighboring sample. In this case, the average of the sample values ​​of the specific upper neighboring samples can be derived as the sample value of the first upper reference sample. In addition, the weight of the specific upper neighboring sample can be derived, and the first upper reference sample can be derived based on the weight and the specific upper neighboring sample. When the weight of the specific upper neighboring sample is derived, the first upper reference sample can be derived based on Equation 1.

[0153] For example, the weight may be derived based on the distance between the specific upper neighboring sample and the first upper reference sample. That is, the weight of the corresponding specific upper neighboring sample among the specific upper neighboring samples may be derived based on the distance between the corresponding specific upper neighboring sample and the first upper reference sample, and, for example, the weight of the corresponding specific upper neighboring sample may be inversely proportional to the distance between the corresponding specific upper neighboring sample and the first upper reference sample.

[0154] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0155] When the specific upper neighboring sample derived based on the prediction direction of the current block includes an upper neighboring sample that is a fractional sample, the sample value of the upper neighboring sample that is the fractional sample can be derived by linear interpolation between the sample values ​​of the integer samples adjacent to the left and right sides of the upper neighboring sample that is the fractional sample. For example, the sample value of the upper neighboring sample that is the fractional sample can be derived based on Equation 2.

[0156] A method for deriving an upper reference sample based on the intra prediction mode of the current block may be determined. For example, when the intra prediction mode of the current block is a mode having a prediction angle greater than the prediction angle of the vertical mode, that is, when the intra prediction mode of the current block is one of the 27th to 34th intra prediction modes, the corresponding upper reference sample of the upper reference sample may be derived based on a specific upper neighboring sample positioned in the prediction direction of the current block based on the position of the corresponding upper reference sample. Here, the vertical mode may correspond to the 26th intra prediction mode. When the intra prediction mode of the current block is a mode having a prediction angle less than or equal to the prediction angle of the vertical mode, that is, when the intra prediction mode of the current block is one of the 18th to 26th intra prediction modes, the corresponding upper reference sample of the upper reference sample may be derived based on an upper neighboring sample positioned in the same column as the column of the corresponding upper reference sample.

[0157] The decoding apparatus derives a column of left reference samples based on the left neighboring samples (S1230).The decoding apparatus may derive a row of left reference samples based on multiple columns of left neighboring samples.

[0158] For example, a left reference sample located in row y among the left reference samples may be derived based on a left neighboring sample located in row y among the left neighboring samples. In this case, the average of the sample values ​​of the left neighboring samples located in row y may be derived as the sample value of the left reference sample located in row y. Furthermore, a weight of the left neighboring sample located in row y may be derived, and the left reference sample located in row y may be derived based on the weight and the left neighboring sample located in row y. When the weight of the left neighboring sample located in row y is derived, the left reference sample may be derived based on Equation 1.

[0159] For example, the weight can be derived based on the distance between the left neighboring sample positioned in the yth row and the left reference sample. That is, the weight of the corresponding left neighboring sample among the left neighboring samples positioned in the yth row can be derived based on the distance between the corresponding left neighboring sample and the left reference sample, and for example, the weight of the corresponding neighboring sample can be inversely proportional to the distance between the corresponding left neighboring sample and the left reference sample. Specifically, when deriving four columns of left neighboring samples, the weights of the left neighboring samples can be derived as 1 / 2, 1 / , 1 / 8, and 1 / 8 in order from right to left. Alternatively, the weights of the left neighboring samples can be derived as 2 / 5, 2 / 5, 1 / 10, and 1 / 10 in order from right to left.

[0160] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0161] As another example, the first left reference sample among the left reference samples can be derived based on a specific left neighboring sample derived based on the position of the first left reference sample of the current block and the prediction direction of the current block. Specifically, the specific left neighboring sample positioned in the prediction direction of the current block can be derived based on the position of the left reference sample, and the left reference sample can be derived based on the specific left neighboring sample. In this case, the average of the sample values ​​of the specific left neighboring samples can be derived as the sample value of the first left reference sample. Furthermore, a weight for the specific left neighboring sample can be derived, and the first left reference sample can be derived based on the weight and the specific left neighboring sample. When the weight for the specific left neighboring sample is derived, the first left reference sample can be derived based on Equation 1.

[0162] For example, the weight may be derived based on the distance between the specific left neighboring sample and the first left reference sample. That is, the weight of the corresponding specific left neighboring sample among the specific left neighboring samples may be derived based on the distance between the corresponding specific left neighboring sample and the first left reference sample, and, for example, the weight of the corresponding specific left neighboring sample may be inversely proportional to the distance between the corresponding specific left neighboring sample and the first left reference sample.

[0163] Furthermore, in another example, the weights may be derived based on a quantization parameter (QP) or size of the current block. Furthermore, the weights may be derived based on various criteria.

[0164] When the specific left neighboring sample derived based on the prediction direction of the current block includes the left neighboring sample as a fractional sample, the sample value of the left neighboring sample as the fractional sample can be derived by linear interpolation between the sample values ​​of the integer samples adjacent to the left and right sides of the left neighboring sample as the fractional sample. For example, the sample value of the left neighboring sample as the fractional sample can be derived based on Equation 2.

[0165] A method for deriving a left reference sample based on the intra prediction mode of the current block may be determined. For example, when the intra prediction mode of the current block is a mode having a prediction angle greater than the prediction angle of the horizontal mode, that is, when the intra prediction mode of the current block is one of the 2nd to 9th intra prediction modes, the corresponding left reference sample of the left reference sample may be derived based on a specific left neighboring sample positioned in the prediction direction of the current block based on the position of the corresponding left reference sample. Here, the horizontal mode may correspond to the 10th intra prediction mode. Furthermore, when the intra prediction mode of the current block is a mode having a prediction angle less than or equal to the prediction angle of the horizontal mode, that is, when the intra prediction mode of the current block is one of the 10th to 17th intra prediction modes, the corresponding left reference sample of the left reference sample may be derived based on a left neighboring sample positioned in the same row as the row of the corresponding left reference sample.

[0166] The decoding apparatus generates a prediction sample of the current block using at least one of an upper reference sample and a left reference sample according to the intra prediction mode (S1240). The decoding apparatus may generate the prediction sample based on the upper reference sample or the left reference sample positioned in the prediction direction of the intra prediction mode based on the position of the prediction sample.

[0167] Although not shown in the accompanying drawings, the decoding device may immediately use the predicted samples as reconstructed samples according to the prediction mode, or may add the residual samples to the predicted samples to generate the reconstructed samples. When there are residual samples of the target block, the decoding device may receive information about the residual samples of the target block, and the information about the residual samples may be included in the information about the pace. The information about the residual samples may include transform coefficients related to the residual samples. The decoding device may derive the residual samples (or residual sample arrays) of the target block based on the residual information. The decoding device may generate reconstructed samples based on the predicted samples and the residual samples, and may derive a reconstructed block or a reconstructed picture based on the reconstructed samples. Thereafter, it is described that the decoding device may apply deblocking filtering and / or a loop filtering process such as an SAO process to the reconstructed picture as needed to improve the subjective / objective picture quality.

[0168] According to the present invention, reference samples of a current block can be derived based on multiple neighboring samples, and by performing intra prediction based on the reference samples, prediction accuracy of the current block can be improved, thereby improving overall encoding efficiency.

[0169] In addition, according to the present invention, reference samples can be derived based on multiple neighboring samples positioned in the prediction direction of the intra-frame prediction mode of the current block, and by performing intra-frame prediction based on the reference samples, the prediction accuracy of the current block can be improved, thereby improving the overall encoding efficiency.

[0170] In addition, according to the present invention, weights of multiple neighboring samples can be derived, reference samples can be derived based on the weights and the neighboring samples, and by performing intra prediction based on the reference samples, the prediction accuracy of the current block can be improved, thereby improving the overall encoding efficiency.

[0171] In the above embodiments, these methods are described based on a flow chart having a series of steps or blocks. The present disclosure is not limited to the order of the above steps or blocks. As described above, some steps or blocks may occur simultaneously with other steps or blocks or in a different order. In addition, it will be understood by those skilled in the art that the steps shown in the above flow chart are not exclusive and may include other steps, or one or more steps in the flow chart may be deleted without affecting the scope of the present disclosure.

[0172] The method according to the present invention can be implemented in software. The encoding device and / or decoding device according to the present invention can be included in a device that performs image processing, for example, a TV, a computer, a smart phone, a set-top box or a display device.

[0173] When the embodiments of the present invention are implemented in software, the above methods can be implemented by modules (processing, functions, etc.) that perform the above functions. These modules can be stored in a memory and executed by a processor. The memory can be inside or outside the processor, and the memory can be coupled to the processor using various well-known means. The processor may include an application-specific integrated circuit (ASIC), other chipsets, logic circuits and / or data processing devices. The memory may include ROM (read-only memory), RAM (random access memory), flash memory, memory cards, storage media and / or other storage devices.

Claims

1. A method for decoding an image performed by a decoding device, the method comprising: Obtaining information related to the intra-frame prediction mode and a residual signal through a bit stream; deriving residual samples of the current block based on the residual signal; deriving an intra prediction mode of the current block based on the information related to the intra prediction mode; Deriving upper neighboring samples and left neighboring samples of the current block; deriving a prediction sample of the current block according to the upper neighboring sample, the left neighboring sample and the intra prediction mode of the current block, and generating a reconstructed sample of the current block based on the predicted sample and the residual sample, The upper neighboring samples include upper neighboring samples in the nth row in an upward direction away from the uppermost row of the current block, The left neighboring samples include the left neighboring samples of the nth column located in the left direction away from the leftmost column of the current block, Wherein, n is a positive integer greater than 1, when the size of the current block is N×N, the number of upper neighboring samples of the n-th row is greater than 2N, and N is a positive integer. wherein the additional upper neighboring samples following the 2Nth upper neighboring sample in the nth row of upper neighboring samples are derived by filling specific upper neighboring samples without checking whether the additional upper neighboring samples are available, and The specific upper neighboring sample is an upper neighboring sample closest to the additional upper neighboring sample, excluding the additional upper neighboring sample, among the upper neighboring samples in the n-th row.

2. The method according to claim 1, wherein The first upper neighboring sample in the nth row of upper neighboring samples is located in a vertical direction relative to the upper leftmost sample position of the current block, and the Nth upper neighboring sample in the nth row of upper neighboring samples is located in a vertical direction relative to the upper rightmost sample position of the current block.

3. The method according to claim 1, wherein The specific upper neighboring sample is the 2Nth upper neighboring sample among the upper neighboring samples in the nth row.

4. The method according to claim 1, wherein Based on an upper reference sample derived based on a prediction direction of the current block and located at a fractional sample position, a sample value of the upper reference sample located at the fractional sample position is derived by linear interpolation between sample values ​​of upper neighboring samples at integer sample positions adjacent to the left and right of the upper reference sample.

5. The method according to claim 1, wherein When the size of the current block is N×N, the number of left neighboring samples in the n-th column is greater than 2N, where N is a positive integer.

6. The method according to claim 5, wherein The additional left neighboring samples after the 2Nth left neighboring sample in the nth column of left neighboring samples are derived by padding specific left neighboring samples without checking whether the additional left neighboring samples are available, and The specific left-neighboring sample is a left-neighboring sample that is closest to the additional left-neighboring sample among the left-neighboring samples in the n-th column, excluding the additional left-neighboring sample.

7. A decoding device for decoding an image, comprising: an entropy decoding unit, configured to obtain information related to the intra prediction mode and a residual signal through a bit stream, and derive a residual sample of the current block based on the residual signal; Prediction unit, used to: deriving an intra prediction mode of the current block based on the information related to the intra prediction mode; Deriving upper neighboring samples and left neighboring samples of the current block; deriving a prediction sample of the current block according to the upper neighboring sample, the left neighboring sample and the intra prediction mode of the current block, and generating a reconstructed sample of the current block based on the predicted sample and the residual sample, The upper neighboring samples include upper neighboring samples in the nth row in an upward direction away from the uppermost row of the current block, The left neighboring samples include the left neighboring samples of the nth column located in the left direction away from the leftmost column of the current block, Wherein, n is a positive integer greater than 1, when the size of the current block is N×N, the number of upper neighboring samples of the n-th row is greater than 2N, and N is a positive integer. wherein the additional upper neighboring samples following the 2Nth upper neighboring sample in the nth row of upper neighboring samples are derived by filling specific upper neighboring samples without checking whether the additional upper neighboring samples are available, and The specific upper neighboring sample is an upper neighboring sample closest to the additional upper neighboring sample, excluding the additional upper neighboring sample, among the upper neighboring samples in the n-th row.

8. A method for encoding an image, performed by an encoding device, the method comprising: Deriving the intra prediction mode of the current block; Deriving upper neighboring samples and left neighboring samples of the current block; deriving a prediction sample of the current block according to the upper neighboring sample, the left neighboring sample and the intra prediction mode of the current block; deriving residual samples of the current block based on the prediction samples; generating information related to the intra prediction mode and a residual signal based on the intra prediction mode of the current block; as well as encoding the image information including the information related to the intra prediction mode and the residual signal to generate a bitstream, The upper neighboring samples include upper neighboring samples in the nth row in an upward direction away from the uppermost row of the current block, The left neighboring samples include the left neighboring samples of the nth column located in the left direction away from the leftmost column of the current block, Wherein, n is a positive integer greater than 1, when the size of the current block is N×N, the number of upper neighboring samples of the n-th row is greater than 2N, and N is a positive integer. wherein the additional upper neighboring samples following the 2Nth upper neighboring sample in the nth row of upper neighboring samples are derived by filling specific upper neighboring samples without checking whether the additional upper neighboring samples are available, and The specific upper neighboring sample is an upper neighboring sample closest to the additional upper neighboring sample, excluding the additional upper neighboring sample, among the upper neighboring samples in the n-th row.

9. An encoding device for encoding an image, comprising: Prediction unit, used to: Deriving the intra prediction mode of the current block; Deriving upper neighboring samples and left neighboring samples of the current block; deriving a prediction sample of the current block according to the upper neighboring sample, the left neighboring sample and the intra prediction mode of the current block; Coding unit, used for: deriving residual samples of the current block based on the prediction samples; generating information related to the intra prediction mode and a residual signal based on the intra prediction mode of the current block; as well as encoding the image information including the information related to the intra prediction mode and the residual signal to generate a bitstream, The upper neighboring samples include upper neighboring samples in the nth row in an upward direction away from the uppermost row of the current block, The left neighboring samples include the left neighboring samples of the nth column located in the left direction away from the leftmost column of the current block, Wherein, n is a positive integer greater than 1, when the size of the current block is N×N, the number of upper neighboring samples of the n-th row is greater than 2N, and N is a positive integer. wherein the additional upper neighboring samples following the 2Nth upper neighboring sample in the nth row of upper neighboring samples are derived by filling specific upper neighboring samples without checking whether the additional upper neighboring samples are available, and The specific upper neighboring sample is an upper neighboring sample closest to the additional upper neighboring sample, excluding the additional upper neighboring sample, among the upper neighboring samples in the n-th row.

10. A computer-readable storage medium having computer instructions and bit streams stored thereon, characterized in that: When the computer instructions are executed by a processor, the steps of the encoding method according to claim 8 are implemented to generate the bit stream.