Video encoding / decoding method and apparatus, and recording medium storing bitstreams

The method improves video compression by using gradient-based weighted sums for intra prediction, addressing inefficiencies in high-resolution image handling and reducing artifacts.

JP2026501658APending Publication Date: 2026-01-16LG ELECTRONICS INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2025538839
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-01-10
Filing Date
2024-01-10
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing video compression techniques struggle to effectively handle high-resolution and high-quality images, particularly in intra prediction methods, leading to inefficiencies and unintended artifacts.

Method used

A method and apparatus for determining a weighted sum of multiple predicted samples using gradients from surrounding areas of a current block, with weights adapted based on gradient comparisons and block dimensions, to improve prediction accuracy.

Benefits of technology

Enhances prediction performance by considering regional variations and reducing artifacts, thereby improving compression efficiency and image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026501658000001_ABST
    Figure 2026501658000001_ABST
Patent Text Reader

Abstract

A video decoding / encoding method and apparatus according to the present disclosure may generate a first predicted sample for a current sample in a current block based on a left reference sample of the current block, generate a second predicted sample for the current sample based on an upper reference sample of the current block, and generate a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample, where weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample, and the first weight may be determined based on one or more gradients calculated from neighboring regions of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to a video encoding / decoding method and apparatus, and a recording medium storing a bitstream. [Background technology]

[0002] 2. Description of the Related Art In recent years, the demand for high-resolution, high-quality images such as high-definition (HD) images and ultra-high-definition (UHD) images has increased in various application fields, and as a result, highly efficient image compression techniques have been discussed.

[0003] There are various video compression techniques, such as inter-prediction techniques that predict pixel values ​​contained in a current picture from pictures before or after the current picture, intra-prediction techniques that predict pixel values ​​contained in a current picture using pixel information within the current picture, and entropy coding techniques that assign short codes to values ​​that occur frequently and long codes to values ​​that occur less frequently. Using these video compression techniques, video data can be effectively compressed and transmitted or stored. Summary of the Invention [Problem to be solved by the invention]

[0004] The present disclosure seeks to provide an intra prediction method and apparatus.

[0005] The present disclosure seeks to provide a method and apparatus for determining a weighted sum of multiple predicted samples and weights therefor. [Means for solving the problem]

[0006] The video decoding method and apparatus according to the present disclosure may generate a first predicted sample for a current sample in a current block based on a left reference sample of the current block, generate a second predicted sample for the current sample based on an upper reference sample of the current block, and generate a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample.

[0007] In the video decoding method and apparatus according to the present disclosure, the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample, and the first weight may be determined based on one or more gradients calculated from surrounding areas of the current block.

[0008] In the video decoding method and apparatus according to the present disclosure, the gradients calculated from the surrounding region may include a first gradient and a second gradient.

[0009] In the video decoding method and apparatus according to the present disclosure, the surrounding region may be divided into a first surrounding region and a second surrounding region, where the first surrounding region may be a region including one or more reference samples belonging to an upper surrounding block of the current block, and the second surrounding region may be a region including one or more reference samples belonging to a left surrounding block of the current block.

[0010] In the video decoding method and apparatus according to the present disclosure, the first gradient may be derived based on one or more gradients calculated from a first surrounding region of the current block, and the second gradient may be derived based on one or more gradients calculated by applying the one-dimensional filter to a second surrounding region of the current block.

[0011] In the video decoding method and apparatus according to the present disclosure, the first gradient may be derived based on one or more horizontal gradients calculated from a first surrounding region of the current block, and the second gradient may be derived based on one or more vertical gradients calculated from a second surrounding region of the current block.

[0012] In the video decoding method and apparatus according to the present disclosure, the first gradient may be derived based on one or more horizontal gradients calculated from a first surrounding region of the current block and one or more horizontal gradients calculated from a second surrounding region of the current block, and the second gradient may be derived based on one or more vertical gradients calculated from the first surrounding region of the current block and one or more vertical gradients calculated from the second surrounding region of the current block.

[0013] In the video decoding method and apparatus according to the present disclosure, the first weight may be determined based on whether the first gradient is smaller than the second gradient.

[0014] In the video decoding method and apparatus according to the present disclosure, when the first gradient is smaller than the second gradient, the first weighting may be determined based on a maximum value among the first gradient and the second gradient, and when the first gradient is greater than or equal to the second gradient, the first weighting may be determined based on a minimum value among the first gradient and the second gradient.

[0015] In the video decoding method and apparatus according to the present disclosure, when the first gradient is greater than or equal to the second gradient, the first weighting may be determined based on a maximum value among the first gradient and the second gradient, and when the first gradient is smaller than the second gradient, the first weighting may be determined based on a minimum value among the first gradient and the second gradient.

[0016] In the video decoding method and apparatus according to the present disclosure, the first weighting value may be determined based on at least one of whether the width of the current block is greater than the height of the current block, or whether the width and height of the current block are the same.

[0017] In the video decoding method and apparatus according to the present disclosure, when the width of the current block is smaller than the height of the current block, the first weight may be determined based on the maximum value of the first gradient and the second gradient, and when the width of the current block is greater than or equal to the height of the current block, the first weight may be determined based on the minimum value of the first gradient and the second gradient.

[0018] In the video decoding method and apparatus according to the present disclosure, when the width of the current block is greater than or equal to the height of the current block, the first weight may be determined based on the maximum value of the first gradient and the second gradient, and when the width of the current block is smaller than the height of the current block, the first weight may be determined based on the minimum value of the first gradient and the second gradient.

[0019] In the video decoding method and apparatus according to the present disclosure, the one or more gradient-based weightings may be adaptively determined based on at least one of a difference between gradients calculated from the surrounding regions, a size of the current block, a flag, or the availability of reference samples in the surrounding regions.

[0020] A video encoding method and apparatus according to the present disclosure may generate a first predicted sample for a current sample in a current block based on a left reference sample of the current block, generate a second predicted sample for the current sample based on a top reference sample of the current block, and generate a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample, wherein weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample, and the first weight may be determined based on one or more gradients calculated from neighboring regions of the current block.

[0021] A computer-readable digital storage medium is provided having encoded video / image information stored thereon that enables a video decoding method to be performed by a decoding device according to the present disclosure.

[0022] A computer-readable digital storage medium is provided having stored thereon video / image information generated by the video encoding method according to the present disclosure.

[0023] A method and apparatus for transmitting video / image information generated by a video encoding method according to the present disclosure is provided. [Effects of the Invention]

[0024] According to the present disclosure, prediction performance can be improved by considering not only horizontal / vertical linear variations within the current block but also regional variations within the surrounding region.

[0025] According to the present disclosure, the regional variations present in the surrounding area can be reduced to limit unintended artifacts, thereby improving prediction performance.

[0026] According to the present disclosure, by taking into consideration the direction in which more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected. [Brief explanation of the drawings]

[0027] [Figure 1] 1 illustrates a video / image coding system according to the present disclosure. [Figure 2] 1 is a schematic block diagram of an encoding device to which an embodiment of the present disclosure can be applied, in which video / image signals are encoded. [Figure 3] 1 is a schematic block diagram of a decoding device to which an embodiment of the present disclosure can be applied, in which video / image signals are decoded. [Figure 4] 1 is a diagram illustrating an image decoding method performed by a decoding device (300) according to an embodiment of the present disclosure. [Figure 5] FIG. 2 is a diagram illustrating a schematic configuration of an intra prediction unit (331) that performs the video decoding method according to the present disclosure. [Figure 6] 1 is a diagram illustrating a video encoding method performed by an encoding device (200) according to an embodiment of the present disclosure. [Figure 7] FIG. 2 is a diagram showing a schematic configuration of an intra prediction unit (222) that performs the video encoding method according to the present disclosure. [Figure 8] FIG. 1 illustrates an example of a content streaming system to which embodiments of the present disclosure can be applied. DETAILED DESCRIPTION OF THE INVENTION

[0028] While the present disclosure may be modified in various ways and may have various embodiments, specific embodiments are illustrated in the drawings and described in detail. However, this is not intended to limit the present disclosure to the specific embodiments, and it should be understood that the present disclosure includes all modifications, equivalents, and alternatives within the spirit and technical scope of the present disclosure. In the description of each figure, similar reference numerals are used to refer to similar components.

[0029] Terms such as "first," "second," etc. may be used to describe various components, but these components should not be limited by such terms. These terms are used merely to distinguish one component from another. For example, a first component could be termed a second component, and similarly, a second component could be termed a first component, without departing from the scope of this disclosure. The term "and / or" includes a combination of multiple associated listed items or any item of multiple associated listed items.

[0030] When a component is referred to as being "coupled" or "connected" to another component, it should be understood that the component may be directly coupled or connected to the other component, and that there may be additional components in between. On the other hand, when a component is referred to as being "directly coupled" or "directly connected" to another component, it should be understood that there are no additional components in between.

[0031] The terms used in this application are merely for the purpose of describing particular embodiments and are not intended to limit the present disclosure. The singular terms include the plural terms unless the context clearly dictates otherwise. In this application, terms such as "comprise" or "have" (comprising; constituting; constructing; setting; including; containing; containing; having) are intended to specify the presence of features, numbers, steps, operations, components, parts, or combinations thereof described in the specification, but should be understood as not precluding the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof.

[0032] The present disclosure relates to video / image coding. For example, the methods / embodiments disclosed herein may be applied to methods disclosed in the versatile video coding (VVC) standard. The methods / embodiments disclosed herein may also be applied to methods disclosed in the essential video coding (EVC) standard, the AOMedia Video 1 (AV1) standard, the second generation audio video coding standard (AVS2), or next-generation video / image coding standards (e.g., H.267 or H.268).

[0033] This specification presents various embodiments relating to video / image coding, and unless otherwise stated, the above embodiments may be performed in combination with each other.

[0034] In this specification, video may refer to a collection of a series of images over time. A picture generally refers to a unit representing an image at a specific time period, and a slice / tile is a unit constituting part of a picture in coding. A slice / tile may include one or more coding tree units (CTUs). One picture may be composed of one or more slices / tiles. A tile is a rectangular area composed of multiple CTUs in a specific tile column and a specific tile row of a picture. A tile column is a rectangular area of ​​CTUs having the same height as the picture and a width specified by the syntax requirements of the picture parameter set. A tile row is a rectangular area of ​​CTUs having the same height as the picture and a width specified by the picture parameter set. CTUs within a tile may be arranged consecutively by CTU raster scanning, while tiles within a picture may be arranged consecutively by tile raster scanning. A slice may contain an integer number of complete tiles or an integer number of consecutive complete CTU rows within the tiles of a picture that may be contained exclusively in a single NAL unit, while a picture may be partitioned into two or more sub-pictures, which may be rectangular regions of one or more slices in a picture.

[0035] A picture element, pixel, or pel can refer to the smallest unit that makes up a picture (or an image). A "sample" can also be used as a term corresponding to a pixel. A sample can generally indicate a pixel or a pixel value, and may indicate only a pixel / pixel value of a luminance (luma) component, or may indicate only a pixel / pixel value of a chrominance (chroma) component.

[0036] A unit may refer to a basic unit of image processing. A unit may include at least one of a specific region of a picture and information related to that region. One unit may include one luma block and two chroma (e.g., cb, cr) blocks. The term unit may sometimes be used interchangeably with terms such as block or area. In general, an MxN block may include a set (or array) of samples or transform coefficients consisting of M columns and N rows.

[0037] As used herein, "A or B" can mean "A only," "B only," or "both A and B." In other words, as used herein, "A or B" can be interpreted as "A and / or B." For example, as used herein, "A, B, or C" can mean "A only," "B only," "C only," or "any combination of A, B, and C."

[0038] As used herein, a slash ( / ) or a comma can mean "and / or." For example, "A / B" can mean "A and / or B." Thus, "A / B" can mean "A only," "B only," or "both A and B." For example, "A, B, C" can mean "A, B, or C."

[0039] As used herein, "at least one of A and B" can mean "A only," "B only," or "both A and B." Furthermore, as used herein, the expressions "at least one of A or B" or "at least one of A and / or B" may be interpreted as being the same as "at least one of A and B."

[0040] Furthermore, in this specification, "at least one of A, B, and C" can mean "A only," "B only," "C only," or "any combination of A, B, and C." Furthermore, "at least one of A, B, or C" or "at least one of A, B, and / or C" can mean "at least one of A, B, and C."

[0041] Furthermore, parentheses used in this specification may mean "for example." Specifically, when "prediction (intra prediction)" is displayed, "intra prediction" may be suggested as an example of "prediction." In other words, "prediction" in this specification is not limited to "intra prediction," and "intra prediction" may be suggested as an example of "prediction." Furthermore, when "prediction (i.e., intra prediction)" is displayed, "intra prediction" may be suggested as an example of "prediction."

[0042] In this specification, technical features individually described in the same drawing may be embodied individually or simultaneously.

[0043] FIG. 1 is a diagram illustrating a video / image coding system according to this disclosure.

[0044] Referring to FIG. 1, a video / image coding system may include a first device (a source device) and a second device (a receiving device).

[0045] A source device can transmit encoded video / image information or data to a receiving device via a digital storage medium or a network in the form of a file or streaming. The source device may include a video source, an encoding device, and a transmitting unit. The receiving device may include a receiving unit, a decoding device, and a renderer. The encoding device may be called a video / image encoding device, and the decoding device may be called a video / image decoding device. The transmitter may be included in the encoding device. The receiver may be included in the decoding device. The renderer may include a display unit, which may be a separate device or an external component.

[0046] A video source can acquire video / images through a video / image capture, synthesis, or generation process. A video source can include a video / image capture device and / or a video / image generation device. A video / image capture device can include one or more cameras, a video / image archive containing previously captured video / images, etc. A video / image generation device can include a computer, tablet, smartphone, etc., and can (electronically) generate video / images. For example, a virtual video / image can be generated through a computer, etc., in which case the video / image capture process can be replaced by a process in which the associated data is generated.

[0047] An encoding device may encode input video / images. The encoding device may perform a series of steps such as prediction, transformation, and quantization for compression and coding efficiency. The encoded data (encoded video / image information) may be output in the form of a bitstream.

[0048] The transmitting unit can transmit the encoded video / image information or data output in the form of a bitstream to a receiving unit of a receiving device via a digital storage medium or a network in the form of a file or streaming. The digital storage medium can include various storage media such as USB, SD, CD, DVD, Blu-ray (registered trademark: the same applies hereinafter), HDD, SSD, etc. The transmitting unit can include elements for generating a media file according to a predetermined file format and elements for transmission via a broadcasting / communication network. The receiving unit can receive / extract the bitstream and transmit it to a decoding device.

[0049] The decoding device can decode the video / image by performing a series of steps such as inverse quantization, inverse transform, and prediction, which correspond to the operations of the encoding device.

[0050] The renderer can render the decoded video / image, and the rendered video / image can be displayed on a display unit.

[0051] FIG. 2 is a schematic block diagram of an encoding device to which the embodiments of the present disclosure can be applied, in which video / image signals are encoded.

[0052] Referring to FIG. 2, the encoding apparatus 200 may include an image partitioner 210, a predictor 220, a residual processor 230, an entropy encoder 240, an adder 250, a filter 260, and a memory 270. The predictor 220 may include an inter-prediction unit 221 and an intra-prediction unit 222. The residual processor 230 may include a transformer 232, a quantizer 233, a dequantizer 234, and an inverse transformer 235. The residual processor 230 may further include a subtractor 231. The adder 250 may be referred to as a reconstructor or a reconstructed block generator. The above-described image divider 210, predictor 220, residual processor 230, entropy encoder 240, adder 250, and filterer 260 may be configured by one or more hardware components (e.g., an encoding device chipset or processor) depending on the embodiment. In addition, the memory 270 may include a decoded picture buffer (DPB) and may be configured by a digital storage medium. The hardware components may further include the memory 270 as an internal / external component.

[0053] The image division unit 210 may divide an input image (or picture, frame) input to the encoding device 200 into one or more processing units. For example, the processing units may be called coding units (CUs). In this case, the coding units may be recursively divided into coding tree units (CTUs) or largest coding units (LCUs) according to a QTBTTT (Quad-tree, Binary-tree, Ternary-tree) structure.

[0054] For example, one coding unit may be divided into multiple coding units having deeper depths based on a quadtree structure, a binary tree structure, and / or a tertiary structure. In this case, for example, the quadtree structure may be applied first, and then the binary tree structure and / or the tertiary structure may be applied later. Alternatively, the binary tree structure may be applied before the quadtree structure. The coding procedure according to the present specification may be performed based on a final coding unit that is not further divided. In this case, based on coding efficiency according to video characteristics, the largest coding unit may be immediately used as the final coding unit, or, if necessary, the coding unit may be recursively divided into coding units of lower depths, and the coding unit with the optimal size may be used as the final coding unit. Here, the coding procedure may include procedures such as prediction, transformation, and restoration, which will be described later.

[0055] As another example, the processing unit may further include a prediction unit (PU) or a transform unit (TU). In this case, the prediction unit and the transform unit may be divided or partitioned from the final coding unit. The prediction unit may be a unit of sample prediction, and the transform unit may be a unit for deriving transform coefficients and / or a unit for deriving a residual signal from the transform coefficients.

[0056] The term "unit" may be used interchangeably with terms such as "block" or "area." In general, an MxN block may represent a set of samples or transform coefficients consisting of M columns and N rows. A sample may generally represent a pixel or a pixel value, and may represent only a pixel / pixel value of a luma component or only a pixel / pixel value of a chroma component. A sample may be used in terms corresponding to one picture (or image), pixel, or pel.

[0057] The encoding apparatus 200 may subtract a prediction signal (prediction block, prediction sample array) output from the inter prediction unit 221 or the intra prediction unit 222 from an input video signal (original block, original sample array) to generate a residual signal (residual block, residual sample array), and the generated residual signal is transmitted to the conversion unit 232. In this case, a unit in the encoding apparatus 200 that subtracts the prediction signal (prediction block, prediction sample array) from the input video signal (original block, original sample array) may be referred to as a subtraction unit 231.

[0058] The prediction unit 220 may perform prediction on a current block (hereinafter referred to as a current block) and generate a predicted block including prediction samples for the current block. The prediction unit 220 may determine whether intra prediction or inter prediction is applied to the current block or CU. The prediction unit 220 may generate various information related to prediction, such as prediction mode information, as will be described later in the description of each prediction mode, and transmit the information related to prediction to the entropy encoding unit 240. The entropy encoding unit 240 may encode the information related to prediction and output it in the form of a bitstream.

[0059] The intra prediction unit 222 may predict the current block by referring to samples in the current picture. The referenced samples may be located in the neighborhood of the current block or at a certain distance from the current block depending on the prediction mode. In intra prediction, prediction modes may include one or more non-directional modes and multiple directional modes. The non-directional modes may include at least one of DC mode and planar mode. The directional modes may include 33 directional modes or 65 directional modes depending on the granularity of the prediction direction. However, this is merely an example, and more or less directional modes may be used depending on the settings. The intra prediction unit 222 may also determine the prediction mode to be applied to the current block using the prediction modes applied to neighboring blocks.

[0060] The inter prediction unit 221 may derive a prediction block for a current block based on a reference block (reference sample array) identified by a motion vector in a reference picture. To reduce the amount of motion information transmitted in inter prediction mode, the motion information may be predicted in units of blocks, sub-blocks, or samples based on the correlation of motion information between neighboring blocks and the current block. The motion information may include a motion vector and a reference picture index. The motion information may further include inter prediction direction information (e.g., L0 prediction, L1 prediction, Bi prediction, etc.). In the case of inter 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 reference block and the reference picture including the temporal neighboring blocks may be the same or different. The temporal neighboring blocks may be called collocated reference blocks, collocated control units (colCUs), etc., and the reference picture including the temporal neighboring blocks may be called collocated pictures (colPic). For example, the inter prediction unit 221 may configure a motion information candidate list based on neighboring blocks and generate information indicating which candidates are used to derive a motion vector and / or a reference picture index for the current block. Inter prediction may be performed based on various prediction modes. For example, in the case of a skip mode or a merge mode, the inter prediction unit 221 may use motion information of neighboring blocks as motion information for the current block. In the case of the skip mode, unlike in the merge mode, a residual signal may not be transmitted.In the case of motion vector prediction (MVP) mode, the motion vector of the current block can be indicated by using the motion vector of the surrounding block as a motion vector predictor and signaling the motion vector difference.

[0061] The prediction unit 220 may generate a prediction signal based on various prediction methods, which will be described later. For example, the prediction unit may apply intra prediction or inter prediction for predicting a block, or may simultaneously apply intra prediction and inter prediction. This may be referred to as a combined inter and intra prediction (CIIP) mode. The prediction unit may also use an intra block copy (IBC) prediction mode or a palette mode for predicting a block. The IBC prediction mode or palette mode may be used for coding content images / videos, such as games, such as screen content coding (SCC). IBC basically performs prediction within a current picture, but may be similar to inter prediction in that it derives a reference block within the current picture. That is, IBC may use at least one of the inter prediction techniques described herein. The palette mode may be considered an example of intra coding or intra prediction. When the palette mode is applied, a sample value within the picture may be signaled based on information about a palette table and a palette index. The predicted signal generated by the prediction unit 220 may be used to generate a reconstructed signal or a residual signal.

[0062] The transform unit 232 may generate transform coefficients by applying a transform technique to the residual signal. For example, the transform technique may include at least one of a Discrete Cosine Transform (DCT), a Discrete Sine Transform (DST), a Karhunen-Loeve Transform (KLT), a Graph-Based Transform (GBT), and a Conditionally Non-Linear Transform (CNT). Here, GBT refers to a transform obtained from a graph representing inter-pixel relationship information. CNT refers to a transform obtained based on a predicted signal generated using all previously reconstructed pixels. The transform process may be applied to square pixel blocks of the same size, or to non-square blocks of variable sizes.

[0063] The quantization unit 233 quantizes the transform coefficients and transmits the quantized signal to the entropy encoding unit 240. The entropy encoding unit 240 encodes the quantized signal (information about the quantized transform coefficients) and outputs it as a bitstream. The information about the quantized transform coefficients may be referred to as residual information. The quantization unit 233 rearranges the quantized transform coefficients in a block form into a one-dimensional vector form based on a coefficient scan order, and generates information about the quantized transform coefficients based on the quantized transform coefficients in the one-dimensional vector form.

[0064] The entropy encoding unit 240 can perform various encoding methods such as exponential Golomb, context-adaptive variable length coding (CAVLC), context-adaptive binary arithmetic coding (CABAC), etc. The entropy encoding unit 240 can encode information necessary for video / image restoration (e.g., values ​​of syntax elements) together with or separately from the quantized transform coefficients.

[0065] Encoded information (e.g., encoded video / video information) may be transmitted or stored in the form of a bitstream in network abstraction layer (NAL) units. The video / video information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). The video / video information may also include general constraint information. In this specification, information and / or syntax elements transmitted / signaled from an encoding device to a decoding device may be included in the video / video information. The video / video information may be encoded using the encoding procedure described above and included in the bitstream. The bitstream may be transmitted over a network or stored in a digital storage medium. Here, the network may include a broadcast network and / or a communication network, and the digital storage medium may include various storage media, such as a USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. The signal output from the entropy encoding unit 240 may be transmitted to a transmitting unit (not shown) and / or stored to a storing unit (not shown) configured as an internal / external element of the encoding device 200, or the transmitting unit may be included in the entropy encoding unit 240.

[0066] The quantized transform coefficients output from the quantization unit 233 may be used to generate a prediction signal. For example, the inverse quantization unit 234 and the inverse transform unit 235 may apply inverse quantization and inverse transform to the quantized transform coefficients to reconstruct a residual signal (residual block or residual sample). The adder 250 may generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the reconstructed residual signal to a prediction signal output from the inter prediction unit 221 or the intra prediction unit 222. When there is no residual for the current block, such as when a skip mode is applied, the predicted block may be used as the reconstructed block. The adder 250 may be referred to as a reconstruction unit or a reconstructed block generator. The generated reconstructed signal may be used for intra prediction of the next block to be processed in the current picture, or may be used for inter prediction of the next picture after filtering, as described below. Meanwhile, LMCS (luma mapping with chroma scaling) may be applied during picture encoding and / or reconstruction.

[0067] The filtering unit 260 may apply filtering to the reconstructed signal to improve subjective / objective image quality. For example, the filtering unit 260 may apply various filtering methods to the reconstructed picture to generate a modified reconstructed picture and store the modified reconstructed picture in the memory 270, specifically, in the DPB of the memory 270. The various filtering methods may include deblocking filtering, sample adaptive offset, an adaptive loop filter, a bilateral filter, etc. The filtering unit 260 may generate various information related to filtering and transmit it to the entropy encoding unit 240. The information related to filtering may be encoded by the entropy encoding unit 240 and output in the form of a bitstream.

[0068] The modified reconstructed picture transmitted to the memory 270 may be used as a reference picture in the inter prediction unit 221. This allows the encoding apparatus to avoid prediction mismatch between the encoding apparatus 200 and the decoding apparatus when inter prediction is applied, and also improves coding efficiency.

[0069] The DPB of the memory 270 may store the modified reconstructed picture to be used as a reference picture in the inter predictor 221. The memory 270 may store motion information of a block from which motion information in the current picture is derived (or encoded) and / or motion information of a block in an already reconstructed picture. The stored motion information may be transmitted to the inter predictor 221 to be used as motion information of a spatially neighboring block or a temporally neighboring block. The memory 270 may store reconstructed samples of reconstructed blocks in the current picture and transmit them to the intra predictor 222.

[0070] FIG. 3 is a schematic block diagram of a decoding device to which the embodiments of the present disclosure can be applied, in which video / image signals are decoded.

[0071] 3, the decoding device 300 may include an entropy decoding unit (entropy decoder 310), a residual processor (residual processor 320), a predictor (predictor 330), an adder (adder 340), a filter (filter 350), and a memory (memory 360). The predictor 330 may include an inter predictor 331 and an intra predictor 332. The residual processor 320 may include a dequantizer (dequantizer 321) and an inverse transformer (inverse transformer 322).

[0072] The entropy decoding unit 310, residual processing unit 320, prediction unit 330, addition unit 340, and filtering unit 350 may be configured as a single hardware component (e.g., a decoding device chipset or processor) depending on the embodiment. Also, the memory 360 may include a decoded picture buffer (DPB) and may be configured as a digital storage medium. The hardware component may further include the memory 360 as an internal / external component.

[0073] When a bitstream including video / image information is input, the decoding apparatus 300 can reconstruct an image corresponding to the process by which the video / image information was processed by the encoding apparatus of FIG. 2. For example, the decoding apparatus 300 can derive units / blocks based on block division-related information obtained from the bitstream. The decoding apparatus 300 can perform decoding using a processing unit applied by the encoding apparatus. Accordingly, the processing unit for decoding may be a coding unit, which may be divided from a coding tree unit or a maximum coding unit according to a quad tree structure, a binary tree structure, and / or a tertiary tree structure. One or more transform units may be derived from the coding unit. The reconstructed image signal decoded and output by the decoding apparatus 300 may be played back by a playback device.

[0074] The decoding apparatus 300 may receive a signal output from the encoding apparatus of FIG. 2 in the form of a bitstream, and the received signal may be decoded by the entropy decoding unit 310. For example, the entropy decoding unit 310 may parse the bitstream and derive information (e.g., video / video information) necessary for video restoration (or picture restoration). The video / video information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). The video / video information may also include general constraint information. The decoding apparatus may decode pictures further based on the information on the parameter sets and / or the general constraint information. Signal / received information and / or syntax elements described later in this specification may be decoded by the decoding procedure and obtained from the bitstream. For example, the entropy decoding unit 310 may decode information in a bitstream based on a coding method such as Exponential-Golomb coding, CAVLC, or CABAC, and output values ​​of syntax elements required for image restoration and quantized values ​​of transform coefficients related to residuals. More specifically, the CABAC entropy decoding method receives bins corresponding to each syntax element in the bitstream, determines a context model using information on the syntax element to be decoded, decoding information on neighboring and current blocks, or information on symbols / bins decoded in previous steps, predicts the occurrence probability of the bins based on the determined context model, and generates symbols corresponding to the values ​​of each syntax element by performing arithmetic decoding of the bins. In this case, after determining the context model, the CABAC entropy decoding method may update the context model using information on the decoded symbols / bins for the context model of the next symbol / bin.Information related to prediction among the information decoded by the entropy decoding unit 310 may be provided to a prediction unit (inter prediction unit 332 and intra prediction unit 331), and residual values ​​entropy decoded by the entropy decoding unit 310, i.e., quantized transform coefficients and related parameter information, may be input to a residual processing unit 320. The residual processing unit 320 may derive a residual signal (residual block, residual sample, residual sample array). In addition, information related to filtering among the information decoded by the entropy decoding unit 310 may be provided to a filtering unit 350. Meanwhile, a receiving unit (not shown) that receives a signal output from the encoding apparatus may be further configured as an internal / external element of the decoding apparatus 300, or the receiving unit may be a component of the entropy decoding unit 310.

[0075] Meanwhile, the decoding apparatus according to the present specification may be referred to as a video / image / picture decoding apparatus, and the decoding apparatus may be divided into an information decoding apparatus (video / image / picture information decoding apparatus) and a sample decoding apparatus (video / image / picture sample decoding apparatus). The information decoding apparatus may include the entropy decoding unit 310, and the sample decoding apparatus may include at least one of the inverse quantization unit 321, the inverse transform unit 322, the addition unit 340, the filtering unit 350, the memory 360, the inter prediction unit 332, and the intra prediction unit 331.

[0076] The inverse quantization unit 321 may inverse quantize the quantized transform coefficients and output the transform coefficients. The inverse quantization unit 321 may rearrange the quantized transform coefficients in a two-dimensional block format. In this case, the rearrangement may be performed based on the coefficient scanning order performed in the encoding apparatus. The inverse quantization unit 321 may inverse quantize the quantized transform coefficients using a quantization parameter (e.g., quantization step size information) to obtain transform coefficients.

[0077] The inverse transform unit 322 performs inverse transform on the transform coefficients to obtain a residual signal (residual block, residual sample array).

[0078] The prediction unit 320 may perform prediction on a current block and generate a predicted block including prediction samples for the current block. The prediction unit 320 may determine whether intra prediction or inter prediction is applied to the current block based on the prediction information output from the entropy decoding unit 310, and may determine a specific intra / inter prediction mode.

[0079] The prediction unit 320 may generate a prediction signal based on various prediction methods, which will be described later. For example, the prediction unit 320 may apply intra prediction or inter prediction for predicting a block, or may simultaneously apply intra prediction and inter prediction. This may be referred to as a combined inter and intra prediction (CIIP) mode. The prediction unit may also use an intra block copy (IBC) prediction mode or a palette mode for predicting a block. The IBC prediction mode or palette mode may be used for content video / movie coding, such as games, such as screen content coding (SCC). IBC basically performs prediction within a current picture, but may be similar to inter prediction in that it derives a reference block within the current picture. That is, IBC may use at least one of the inter prediction techniques described herein. The palette mode may be considered an example of intra coding or intra prediction. When the palette mode is applied, information about a palette table and a palette index may be included in the video / picture information and signaled.

[0080] The intra prediction unit 331 may predict a current block by referring to samples in a current picture. The referenced samples may be located in the neighborhood of the current block or at a certain distance from the current block depending on the prediction mode. In intra prediction, prediction modes may include one or more non-directional modes and multiple directional modes. The intra prediction unit 331 may determine a prediction mode to be applied to the current block using prediction modes applied to neighboring blocks.

[0081] The inter prediction unit 332 may derive a prediction block for a current block based on a reference block (reference sample array) identified by a motion vector in a reference picture. To reduce the amount of motion information transmitted in inter prediction mode, the motion information may be predicted in units of blocks, sub-blocks, or samples based on the correlation of motion information between neighboring blocks and the current block. The motion information may include a motion vector and a reference picture index. The motion information may further include inter prediction direction information (e.g., L0 prediction, L1 prediction, Bi prediction, etc.). In the case of inter prediction, the neighboring blocks may include spatial neighboring blocks in the current picture and temporal neighboring blocks in the reference picture. For example, the inter prediction unit 332 may construct a motion information candidate list based on the neighboring blocks and derive a motion vector and / or a reference picture index for the current block based on received candidate selection information. Inter prediction may be performed based on various prediction modes, and the prediction information may include information indicating the inter prediction mode for the current block.

[0082] The adder 340 can generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the acquired residual signal to a prediction signal (prediction block, prediction sample array) output from a prediction unit (including the inter prediction unit 332 and / or the intra prediction unit 331). When there is no residual for the current block, such as when the skip mode is applied, the prediction block may be used as the reconstructed block.

[0083] The adder 340 may be referred to as a reconstruction unit or a reconstruction block generator. The generated reconstruction signal may be used for intra prediction of a next block to be processed in a current picture, may be output after filtering as described below, or may be used for inter prediction of a next picture. Meanwhile, luma mapping with chroma scaling (LMCS) may be applied during picture decoding.

[0084] The filtering unit 350 may apply filtering to the reconstructed signal to improve subjective / objective image quality. For example, the filtering unit 350 may apply various filtering methods to the reconstructed picture to generate a modified reconstructed picture, and may transmit the modified reconstructed picture to the memory 360, specifically, to the DPB of the memory 360. The various filtering methods may include deblocking filtering, sample adaptive offset, an adaptive loop filter, a bilateral filter, etc.

[0085] The (modified) reconstructed picture stored in the DPB of the memory 360 may be used as a reference picture in the inter predictor 332. The memory 360 may store motion information of a block from which motion information in the current picture is derived (or decoded) and / or motion information of a block in an already reconstructed picture. The stored motion information may be transmitted to the inter predictor 260 to be used as motion information of a spatially neighboring block or a temporally neighboring block. The memory 360 may store reconstructed samples of reconstructed blocks in the current picture and transmit them to the intra predictor 331.

[0086] In this specification, the embodiments described for the filtering unit 260, inter prediction unit 221, and intra prediction unit 222 of the encoding device 200 may also be applied identically or correspondingly to the filtering unit 350, inter prediction unit 332, and intra prediction unit 331 of the decoding device 300, respectively.

[0087] FIG. 4 illustrates a video decoding method performed by a decoding device according to the present disclosure.

[0088] Referring to FIG. 4, a first predicted sample for a current sample in a current block may be generated (S400).

[0089] The current sample represents a sample currently to be predicted within the current block. The first predicted sample may be generated based on one or more samples belonging to a left peripheral region of the current block. Here, the left peripheral region may be a region including at least one of a left peripheral block, an upper left peripheral block, or a lower left peripheral block adjacent to the current block.

[0090] The first predicted sample may be generated based on one or more samples located on the same horizontal line as the first predicted sample among the samples belonging to the left peripheral region.

[0091] The first predicted sample may be generated based on a weighted sum of samples belonging to a left peripheral region of the current block and samples belonging to a right upper peripheral region of the current block. For example, the first predicted sample may be derived as shown in Equation 1 below.

[0092]

number

[0093] In Equation 1, pred Horizontalwhere rec(W, H) represents the first predicted sample of the current block, and W and H represent the width and height of the current block, respectively. (x, y) represents the coordinates of the first predicted sample within the current block, where x ranges from 0 to (W-1) and y ranges from 0 to (H-1). If the position of the top-left sample within the current block is (0, 0), rec(-1, y) may represent the left reference sample of the current block. For example, the left reference sample may represent a sample belonging to a left sample line that has already been reconstructed before coding the current block and has the same y-coordinate as the first predicted sample. Similarly, rec(W, -1) may represent the top-right reference sample of the current block. For example, the top-right reference sample may represent a sample that has already been reconstructed before coding the current block and is adjacent to the top-right corner of the current block.

[0094] Referring to FIG. 4, a second predicted sample for the current sample may be generated (S410).

[0095] The second predicted sample of the current block may have the same position or coordinate as the first predicted sample. The second predicted sample of the current block may be generated based on one or more samples belonging to an upper peripheral region of the current block. Here, the upper peripheral region may be a region including at least one of an upper peripheral block, an upper left peripheral block, or an upper right peripheral block adjacent to the current block.

[0096] The second predicted sample may be generated based on one or more samples located on the same vertical line as the second predicted sample among the samples belonging to the top peripheral region.

[0097] The second predicted sample may be generated based on a weighted sum of samples belonging to the top peripheral region of the current block and samples belonging to the bottom left peripheral region of the current block. For example, the second predicted sample may be derived as shown in Equation 2 below.

[0098]

number

[0099] In Equation 2, pred vertical where rec(x, y) represents the second predicted sample of the current block, and W and H represent the width and height of the current block, respectively. (x, y) represents the coordinates of the second predicted sample within the current block, where x ranges from 0 to (W-1) and y ranges from 0 to (H-1). If the position of the top-left sample within the current block is (0, 0), rec(x, -1) may represent the top reference sample of the current block. For example, the top reference sample may represent a sample belonging to the top sample line that has been reconstructed before coding the current block and has the same x-coordinate as the second predicted sample. Similarly, rec(-1, H) may represent the bottom-left reference sample of the current block. For example, the bottom-left reference sample may represent a sample that has been reconstructed before coding the current block and is adjacent to the bottom-left corner of the current block.

[0100] Referring to FIG. 4, a final predicted sample for a current sample may be generated based on a weighted sum of the first predicted sample and the second predicted sample (S420).

[0101] The final predicted sample (pred Final) for the current sample may be derived as shown in Equation 3 below.

[0102]

number

[0103] The weighting value for the weighted sum of the first and second predicted samples may include at least one of a first weighting value (w0) applied to the first predicted sample and a second weighting value (w1) applied to the second predicted sample.

[0104] The weights may be set to the same preset weights for both the encoding device and the decoding device. The preset first and second weights may be the same. For example, the preset weights (w0, w1) may be (1 / 2, 1 / 2). However, the sum of w0 and w1 is 1, and w0 and w1 may be different values.

[0105] Alternatively, the weights may be determined based on one or more gradients calculated from the surrounding areas of the current block. Hereinafter, a method for determining weights using the gradients of reference samples belonging to the surrounding areas of the current block will be described in detail.

[0106] [Embodiment] Example 1

[0107] A gradient may be calculated from the surrounding region of the current block by applying a filter having a predetermined size to reference samples belonging to the surrounding region. Here, the surrounding region may be divided into a first surrounding region and a second surrounding region. A gradient may be calculated for each of the first surrounding region and the second surrounding region.

[0108] The first surrounding region may be composed of one or more reference samples belonging to the top surrounding block of the current block. The first surrounding region may be composed of one or more reference samples belonging to the top surrounding block of the current block and one or more reference samples belonging to the upper left surrounding block of the current block. The first surrounding region may be composed of one or more reference samples belonging to the top surrounding block of the current block and one or more reference samples belonging to the upper right surrounding block of the current block. The first surrounding region may be composed of one or more reference samples belonging to the top surrounding block of the current block, one or more reference samples belonging to the upper left surrounding block of the current block, and one or more reference samples belonging to the upper right surrounding block of the current block. However, without being limited thereto, the first surrounding region may further include one or more reference samples belonging to the lower left surrounding block of the current block.

[0109] One or more reference samples belonging to the top peripheral block may belong to the bottommost sample line in the top peripheral block. One or more reference samples belonging to the top-left peripheral block may belong to the bottommost sample line in the top-left peripheral block. One or more reference samples belonging to the top-right peripheral block may belong to the bottommost sample line in the top-right peripheral block. One or more reference samples belonging to the bottom-left peripheral block may belong to the rightmost sample line or the topmost sample line in the bottom-left peripheral block.

[0110] The second surrounding region may be composed of one or more reference samples belonging to the left surrounding block of the current block. The second surrounding region may be composed of one or more reference samples belonging to the left surrounding block of the current block and one or more reference samples belonging to the upper left surrounding block of the current block. The second surrounding region may be composed of one or more reference samples belonging to the left surrounding block of the current block and one or more reference samples belonging to the lower left surrounding block of the current block. The second surrounding region may be composed of one or more reference samples belonging to the left surrounding block of the current block, one or more reference samples belonging to the upper left surrounding block of the current block, and one or more reference samples belonging to the lower left surrounding block of the current block. However, without being limited thereto, the second surrounding region may further include one or more reference samples belonging to the upper right surrounding block of the current block.

[0111] One or more reference samples belonging to the left peripheral block may belong to the rightmost sample line in the left peripheral block. One or more reference samples belonging to the top-left peripheral block may belong to the rightmost sample line in the top-left peripheral block. One or more reference samples belonging to the bottom-left peripheral block may belong to the rightmost sample line in the bottom-left peripheral block. One or more reference samples belonging to the top-right peripheral block may belong to the bottommost sample line or the leftmost sample line in the top-right peripheral block.

[0112] The filter may be a one-dimensional (1-D) filter. The filter may be applied in units of Nx1 size windows within the surrounding region. In this case, each window may include one reference sample and (N-1) neighboring samples located to the left and / or right of the reference sample. Alternatively, the filter may be applied in units of 1xN size windows within the surrounding region. In this case, each window may include one reference sample and (N-1) neighboring samples located above and / or below the reference sample. N may be 3, but is not limited thereto, and N may be an integer of 4, 5, or more.

[0113] As an example, assume that a filter is applied to a 3x1 window in the surrounding area. In this case, a filter for calculating a gradient at a reference sample position may be defined as follows:

[0114]

number

[0115] In Equation 4, G represents the gradient at the reference sample position, and a and b represent the left and right samples of the reference sample, respectively. In Equation 4, n may be an integer greater than or equal to 1. The value calculated by Equation 4 or its absolute value may be used as the gradient at the reference sample position.

[0116] Alternatively, it is assumed that a filter is applied to a 1x3 window unit within the surrounding area. In this case, a filter for calculating a gradient at a reference sample position may be defined as follows:

[0117]

number

[0118] In Equation 5, G represents the gradient at the reference sample position, and c and d represent the upper and lower end samples of the reference sample, respectively. In Equation 5, n may be an integer greater than or equal to 1. The value calculated by Equation 5 or its absolute value may be used as the gradient at the reference sample position.

[0119] A filter may be applied to the first peripheral region in Nx1 window units, and to the second peripheral region in 1xN window units. Alternatively, a filter may be applied to the first peripheral region in 1xN window units, and to the second peripheral region in Nx1 window units. Alternatively, a filter may be applied to the first peripheral region and the second peripheral region in the same window unit size.

[0120] The filter may be applied to one or more available reference samples within the first peripheral region to calculate gradients at the reference sample positions. A first gradient for determining weights may be derived based on the calculated one or more gradients. As an example, a gradient may be calculated for each reference sample position within the first peripheral region, and a value obtained by accumulating the gradients may be calculated. This accumulated value may be set as the first gradient for determining weights. Here, the accumulated value may be defined as the sum of gradients, the absolute value of the sum of gradients, the sum of the absolute values ​​of gradients, or the sum of the squared values ​​of gradients.

[0121] Similarly, the filter may be applied to one or more available reference samples in the second peripheral region to calculate gradients at the reference sample positions. A second gradient for determining the weighting value may be derived based on the calculated one or more gradients. For example, a gradient may be calculated for each reference sample position in the second peripheral region, and a value obtained by accumulating the calculated gradients may be calculated. This accumulated value may be set as the second gradient for determining the weighting value. Here, the accumulated value may be defined as the sum of the gradients, the absolute value of the sum of the gradients, the sum of the absolute values ​​of the gradients, or the sum of the squared values ​​of the gradients.

[0122] The number of reference samples for which gradients are calculated in the first surrounding region may be 1 or 2 or more. For example, the number of reference samples in the first surrounding region may be less than or equal to the width (W) of the current block. Alternatively, the number of reference samples in the first surrounding region may be less than or equal to (2*W+1). Alternatively, the number of reference samples in the first surrounding region may be less than or equal to the sum of the width (W) and height (H) of the current block.

[0123] The number of reference samples for which gradients are calculated in the second surrounding region may be 1 or 2 or more. For example, the number of reference samples in the second surrounding region may be less than or equal to the height (H) of the current block. Alternatively, the number of reference samples in the second surrounding region may be less than or equal to (2*H+1). Alternatively, the number of reference samples in the second surrounding region may be less than or equal to the sum of the width (W) and height (H) of the current block.

[0124] A weight for the weighted sum of the first and second predicted samples may be determined based on at least one of the first gradient and the second gradient calculated by the above-described method. For example, the first weight may be determined based on the maximum value of the first gradient and the second gradient, and the second weight may be determined based on the minimum value of the first gradient and the second gradient. Alternatively, the first weight may be determined based on the minimum value of the first gradient and the second gradient, and the second weight may be determined based on the maximum value of the first gradient and the second gradient. The second weight may be determined based on the first weight.

[0125] The weighting may be determined based on whether the first gradient is less than the second gradient.

[0126] As an example, if the first and second gradients described above are G1 and G2, respectively, the weights may be determined according to the following Equation 6. If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, G1 and / or G2 may be normalized values.

[0127]

number

[0128] According to Equation 6, when G1 is smaller than G2, w0 may be determined based on the maximum value of G1 and G2. On the other hand, when G1 is greater than or equal to G2, w0 may be determined based on the minimum value of G1 and G2. w1 may be determined as 1 minus w0.

[0129] A relatively large weight can be assigned to a prediction sample that references a surrounding region with a relatively large gradient. In this way, prediction performance can be improved by considering not only the horizontal / vertical linear variation within the current block but also the regional variation within the surrounding region.

[0130] Alternatively, if the first gradient and the second gradient are defined as G1 and G2, respectively, the weights may be determined as shown in the following Equation 7. If the number of available reference samples in the first surrounding region and the number of available reference samples in the second surrounding region are different from each other, G1 and / or G2 may be normalized values.

[0131]

number

[0132] According to Equation 7, when G1 is greater than or equal to G2, w0 may be determined based on the maximum value of G1 and G2. On the other hand, when G1 is less than G2, w0 may be determined based on the minimum value of G1 and G2. w1 may be determined as 1 minus w0.

[0133] A relatively larger weight can be assigned to prediction samples that reference surrounding regions with smaller gradients, thus improving prediction performance by adapting less to regional variations present in the reference samples and limiting unintended artifacts.

[0134] The weight value may be determined based on at least one of whether the width (W) and height (H) of the current block are the same, or whether the width (W) of the current block is greater than the height (H) of the current block.

[0135] As an example, if the first gradient and the second gradient are G1 and G2, respectively, the weights may be determined according to the following Equation 8. If the number of available reference samples in the first surrounding region and the number of available reference samples in the second surrounding region are different from each other, G1 and / or G2 may be normalized values.

[0136]

number

[0137] According to Equation 8, when W is greater than H, w0 may be determined based on the maximum value of G1 and G2. On the other hand, when W is smaller than H, w0 may be determined based on the minimum value of G1 and G2. When W and H are the same, w0 may be determined to be 0.5. w1 may be determined to be 1 minus w0.

[0138] When the width of the current block is greater than the height, there may be a case where the correlation between the top reference sample and the current block is low, and in this case, horizontal linear interpolation may provide a more accurate prediction than vertical linear interpolation. Conversely, when the width of the current block is smaller than the height, there may be a case where the correlation between the left reference sample and the current block is low, and in this case, vertical linear interpolation may provide a more accurate prediction than horizontal linear interpolation. As such, by assigning a larger weight to a direction where more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected.

[0139] Alternatively, if the first gradient and the second gradient are defined as G1 and G2, respectively, the weights may be determined as shown in the following Equation 9. If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, G1 and / or G2 may be normalized values.

[0140]

number

[0141] According to Equation 9, when W is smaller than H, w0 may be determined based on the maximum value of G1 and G2. On the other hand, when W is larger than H, w0 may be determined based on the minimum value of G1 and G2. When W and H are the same, w0 may be determined to be 0.5. w1 may be determined to be 1 minus w0.

[0142] When the width of the current block is greater than the height, vertical linear interpolation is more likely to produce accurate prediction because the distance to the reference sample is shorter than that of horizontal linear interpolation. Conversely, when the width of the current block is smaller than the height, horizontal linear interpolation is more likely to produce accurate prediction because the distance to the reference sample is shorter than that of vertical linear interpolation. As such, by assigning a larger weight to a direction where more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected.

[0143] Example 2

[0144] A gradient may be calculated from the surrounding region of the current block by applying a filter having a predetermined size to reference samples belonging to the surrounding region. Here, the surrounding region may be divided into a first surrounding region and a second surrounding region. Either a horizontal gradient or a vertical gradient may be calculated for each of the first surrounding region and the second surrounding region.

[0145] The scopes of the first and second peripheral regions according to the present disclosure are as described in Example 1. Here, one or more reference samples belonging to the top peripheral block may belong to two or more bottom sample lines in the top peripheral block. One or more reference samples belonging to the top-left peripheral block may belong to two or more bottom sample lines in the top-left peripheral block. One or more reference samples belonging to the top-right peripheral block may belong to two or more bottom sample lines in the top-right peripheral block. One or more reference samples belonging to the bottom-left peripheral block may belong to two or more right sample lines or top sample lines in the bottom-left peripheral block. Similarly, one or more reference samples belonging to the left peripheral block may belong to two or more right sample lines in the left peripheral block. One or more reference samples belonging to the top-left peripheral block may belong to two or more right sample lines in the top-left peripheral block. One or more reference samples belonging to the lower left peripheral block may belong to two or more right sample lines in the lower left peripheral block, and one or more reference samples belonging to the upper right peripheral block may belong to two or more bottom or left sample lines in the upper right peripheral block.

[0146] The filter may be a two-dimensional filter. The filter may be applied to a window of size NxN in the surrounding area. Each window may include one reference sample and N neighboring samples. 2 -1) neighboring samples, where N may be 3. However, N is not limited to this and may be an integer of 4, 5, or greater. Alternatively, the filter may be applied in units of a non-square window, such as 2x3, 3x2, etc.

[0147] As an example, assume that a filter is applied to a 3x3 window within the peripheral region. In this case, at least one of a horizontal gradient and a vertical gradient may be calculated for the peripheral region. To this end, a filter for calculating the horizontal gradient (hereinafter referred to as a first filter) and a filter for calculating the vertical gradient (hereinafter referred to as a second filter) may be defined.

[0148] A first filter for calculating the horizontal gradient at the reference sample position in the surrounding region may be defined as follows:

[0149]

number

[0150] In Equation 10, G x represents the horizontal gradient at the reference sample position, and a, c, d, e, f, and h represent the top left sample, top right sample, left sample, right sample, bottom left sample, and bottom right sample, respectively, based on the reference sample. In Equation 10, n may be an integer greater than or equal to 1. According to Equation 10, the horizontal gradient at the reference sample position may be calculated by a weighted sum calculation based on the distance from the reference sample. The value calculated by Equation 10 or its absolute value may be used as the horizontal gradient.

[0151] A second filter for calculating the vertical gradient at the reference sample position in the surrounding region may be defined as follows:

[0152]

number

[0153] In Equation 11, G yrepresents the vertical gradient at the reference sample position, and a, b, c, f, g, and h represent the top left sample, top sample, top right sample, bottom left sample, bottom sample, and bottom right sample, respectively, based on the reference sample. In Equation 11, n may be an integer greater than or equal to 1. According to Equation 11, the vertical gradient at the reference sample position may be calculated by a weighted sum calculation based on the distance from the reference sample. The value calculated by Equation 11 or its absolute value may be used as the vertical gradient.

[0154] A first filter for calculating a horizontal gradient may be applied to the first peripheral region, and a second filter for calculating a vertical gradient may be applied to the second peripheral region, or a first filter for calculating a vertical gradient may be applied to the first peripheral region, and a second filter for calculating a horizontal gradient may be applied to the second peripheral region, or the same filter may be applied to the first peripheral region and the second peripheral region.

[0155] The first filter may be applied to one or more available reference samples within the first peripheral region to calculate horizontal gradients at the reference sample positions. A first gradient for determining a weight value may be derived based on the calculated one or more horizontal gradients. As an example, a horizontal gradient may be calculated for each reference sample position within the first peripheral region, and a value obtained by accumulating the calculated horizontal gradients may be calculated. This accumulated value may be set as the first gradient for determining the weight value. Here, the accumulated value may be defined as the sum of the horizontal gradients, the absolute value of the sum of the horizontal gradients, the sum of the absolute values ​​of the horizontal gradients, or the sum of the squared values ​​of the horizontal gradients.

[0156] The second filter may be applied to one or more available reference samples within the second peripheral region to calculate vertical gradients at the reference sample positions. A second gradient for determining the weighting value may be derived based on the calculated one or more vertical gradients. As an example, a vertical gradient may be calculated for each reference sample position within the second peripheral region, and a value obtained by accumulating the calculated vertical gradients may be calculated. This accumulated value may be set as the second gradient for determining the weighting value. Here, the accumulated value may be defined as the sum of the vertical gradients, the absolute value of the sum of the vertical gradients, the sum of the absolute values ​​of the vertical gradients, or the sum of the squared values ​​of the vertical gradients.

[0157] The number of reference samples for calculating the horizontal gradient in the first surrounding region may be 1 or 2 or more. For example, the number of reference samples in the first surrounding region may be less than or equal to the width (W) of the current block. Alternatively, the number of reference samples in the first surrounding region may be less than or equal to (2*W+1). Alternatively, the number of reference samples in the first surrounding region may be less than or equal to the sum of the width (W) and height (H) of the current block.

[0158] The number of reference samples for calculating the vertical gradient in the second peripheral region may be 1 or 2 or more. For example, the number of reference samples in the second peripheral region may be less than or equal to the height (H) of the current block. Alternatively, the number of reference samples in the second peripheral region may be less than or equal to (2*H+1). Alternatively, the number of reference samples in the second peripheral region may be less than or equal to the sum of the width (W) and height (H) of the current block.

[0159] A weight for the weighted sum of the first and second predicted samples may be determined based on at least one of the first gradient and the second gradient calculated by the above-described method. For example, the first weight may be determined based on the maximum value of the first gradient and the second gradient, and the second weight may be determined based on the minimum value of the first gradient and the second gradient. Alternatively, the first weight may be determined based on the minimum value of the first gradient and the second gradient, and the second weight may be determined based on the maximum value of the first gradient and the second gradient. The second weight may be determined based on the first weight.

[0160] The weighting may be determined based on whether the first gradient is less than the second gradient.

[0161] As an example, the first and second gradients mentioned above are respectively G 1x and G 2y If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weight value may be determined as shown in Equation 12. 1x and / or G 2y may be a normalized value.

[0162]

number

[0163] According to Equation 12, G 1x G 2y If w0 is smaller than G 1x and G 2y On the other hand, G 1x G 2y If w0 is greater than or equal to G 1x and G 2y w1 may be determined based on the minimum value among w0 and w1. w1 may be determined to be 1 minus w0.

[0164] A relatively large weight can be assigned to a prediction sample that references a surrounding region with a relatively large gradient. In this way, prediction performance can be improved by considering not only the horizontal / vertical linear variation within the current block but also the regional variation within the surrounding region.

[0165] Alternatively, the first and second gradients described above can be expressed as G 1x and G 2y If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weights may be determined as follows: 1x and / or G 2y may be a normalized value.

[0166]

number

[0167] According to Equation 13, G 1x G 2y If w0 is greater than or equal to G 1x and G 2y On the other hand, G 1x G 2y If w0 is smaller than G 1x and G 2y w1 may be determined based on the minimum value among w0 and w1. w1 may be determined to be 1 minus w0.

[0168] A relatively larger weight can be assigned to prediction samples that reference surrounding regions with smaller gradients, thus improving prediction performance by adapting less to regional variations present in the reference samples and limiting unintended artifacts.

[0169] The weight value may be determined based on at least one of whether the width (W) and height (H) of the current block are the same, or whether the width (W) of the current block is greater than the height (H) of the current block.

[0170] As an example, the first and second gradients mentioned above are respectively G 1x and G 2y If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weight value may be determined as follows: 1x and / or G 2y may be a normalized value.

[0171]

number

[0172] According to Equation 14, when W is greater than H, w0 is G 1x and G 2y On the other hand, when W is smaller than H, w0 may be determined based on the maximum value of G 1x and G 2y When W and H are the same, w0 may be determined to be 0.5. When W and H are the same, w1 may be determined to be 1 minus w0.

[0173] When the width of the current block is greater than the height, there may be a case where the correlation between the top reference sample and the current block is low, and in this case, horizontal linear interpolation may provide a more accurate prediction than vertical linear interpolation. Conversely, when the width of the current block is smaller than the height, there may be a case where the correlation between the left reference sample and the current block is low, and in this case, vertical linear interpolation may provide a more accurate prediction than horizontal linear interpolation. As such, by assigning a larger weight to a direction where more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected.

[0174] Alternatively, the first and second gradients described above can be expressed as G 1x and G 2yIf the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weight value may be determined as follows: 1x and / or G 2y may be a normalized value.

[0175]

number

[0176] According to Equation 15, when W is smaller than H, w0 is G 1x and G 2y On the other hand, when W is larger than H, w0 may be determined based on the maximum value of G 1x and G 2y When W and H are the same, w0 may be determined to be 0.5. When W and H are the same, w1 may be determined to be 1 minus w0.

[0177] When the width of the current block is greater than the height, vertical linear interpolation is more likely to produce accurate prediction because the distance to the reference sample is shorter than that of horizontal linear interpolation. Conversely, when the width of the current block is smaller than the height, horizontal linear interpolation is more likely to produce accurate prediction because the distance to the reference sample is shorter than that of vertical linear interpolation. As such, by assigning a larger weight to a direction where more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected.

[0178] Example 3

[0179] A gradient may be calculated from the surrounding region of the current block by applying a filter having a predetermined size to reference samples belonging to the surrounding region. Here, the surrounding region may be divided into a first surrounding region and a second surrounding region. The ranges of the first and second surrounding regions are as described in Example 2. In the present disclosure, a horizontal gradient and a vertical gradient may be calculated for each of the first surrounding region and the second surrounding region.

[0180] The filter may be a two-dimensional filter. A first filter for calculating a horizontal gradient and a second filter for calculating a vertical gradient may be defined. This is as described in the second embodiment, and a duplicated description will be omitted here.

[0181] A first filter for calculating a horizontal gradient and a second filter for calculating a vertical gradient may be applied to the first peripheral region, and similarly, a first filter for calculating a horizontal gradient and a second filter for calculating a vertical gradient may be applied to the second peripheral region.

[0182] Specifically, the first filter may be applied to one or more reference samples available in a first peripheral region to calculate horizontal gradients at the corresponding reference sample positions. The calculated one or more horizontal gradients may be accumulated to calculate a first horizontal accumulation value. The first filter may also be applied to one or more reference samples available in a second peripheral region to calculate horizontal gradients at the corresponding reference sample positions. The calculated one or more horizontal gradients may be accumulated to calculate a second horizontal accumulation value. A first gradient for determining the weighting value may be derived based on the first and second horizontal accumulation values. Here, the first or second horizontal accumulation value may be defined as the sum of horizontal gradients, the absolute value of the sum of horizontal gradients, the sum of the absolute values ​​of horizontal gradients, or the sum of the squares of horizontal gradients.

[0183] The second filter may be applied to one or more reference samples available in a first peripheral region to calculate vertical gradients at the reference sample positions. The calculated one or more vertical gradients may be accumulated to calculate a first vertical accumulation value. Furthermore, the second filter may be applied to one or more reference samples available in a second peripheral region to calculate vertical gradients at the reference sample positions. The calculated one or more vertical gradients may be accumulated to calculate a second vertical accumulation value. A second gradient for determining the weighting value may be derived based on the first and second vertical accumulation values. Here, the first or second vertical accumulation value may be defined as the sum of the vertical gradients, the absolute value of the sum of the vertical gradients, the sum of the absolute values ​​of the vertical gradients, or the sum of the squared values ​​of the vertical gradients.

[0184] The number of reference samples for which horizontal / vertical gradients are calculated in the first surrounding region may be 1 or 2 or more. For example, the number of reference samples in the first surrounding region may be less than or equal to the width (W) of the current block. Alternatively, the number of reference samples in the first surrounding region may be less than or equal to (2*W+1). Alternatively, the number of reference samples in the first surrounding region may be less than or equal to the sum of the width (W) and height (H) of the current block.

[0185] The number of reference samples for calculating horizontal / vertical gradients in the second surrounding region may be 1 or 2 or more. For example, the number of reference samples in the second surrounding region may be less than or equal to the height (H) of the current block. Alternatively, the number of reference samples in the second surrounding region may be less than or equal to (2*H+1). Alternatively, the number of reference samples in the second surrounding region may be less than or equal to the sum of the width (W) and height (H) of the current block.

[0186] A weight for the weighted sum of the first and second predicted samples may be determined based on at least one of the first gradient or the second gradient calculated by the above-described method. For example, the first weight may be determined based on the maximum value of the first gradient and the second gradient, and the second weight may be determined based on the minimum value of the first gradient and the second gradient. Alternatively, the first weight may be determined based on the minimum value of the first gradient and the second gradient, and the second weight may be determined based on the maximum value of the first gradient and the second gradient. The second weight may be determined based on the first weight.

[0187] The weighting may be determined based on whether the first gradient is less than the second gradient.

[0188] As an example, the first and second gradients mentioned above are respectively G x and G y If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weight value may be determined as follows: x and / or G y may be a normalized value.

[0189]

number

[0190] According to Equation 16, G x G y If w0 is smaller than G x and G y On the other hand, G x G y If w0 is greater than or equal to G x and G y w1 may be determined based on the minimum value among w0 and w1. w1 may be determined to be 1 minus w0.

[0191] A relatively large weight can be assigned to a prediction sample that references a surrounding region with a relatively large gradient. In this way, prediction performance can be improved by considering not only the horizontal / vertical linear variation within the current block but also the regional variation within the surrounding region.

[0192] Alternatively, the first and second gradients described above can be expressed as G x and G y If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weight value may be determined as follows: x and / or G y may be a normalized value.

[0193]

number

[0194] According to Equation 17, G x G y If w0 is greater than or equal to G x and G y On the other hand, G x G y If w0 is smaller than G x and G y w1 may be determined based on the minimum value among w0 and w1. w1 may be determined to be 1 minus w0.

[0195] A relatively larger weight can be assigned to prediction samples that reference surrounding regions with smaller gradients, thus improving prediction performance by adapting less to regional variations present in the reference samples and limiting unintended artifacts.

[0196] The weight value may be determined based on at least one of whether the width (W) and height (H) of the current block are the same, or whether the width (W) of the current block is greater than the height (H) of the current block.

[0197] As an example, the first and second gradients mentioned above are respectively G x and G y If the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weight value may be determined as follows: x and / or G y may be a normalized value.

[0198]

number

[0199] According to Equation 18, when W is greater than H, w0 is G x and G y On the other hand, when W is smaller than H, w0 may be determined based on the maximum value of G x and G y When W and H are the same, w0 may be determined to be 0.5. When W and H are the same, w1 may be determined to be 1 minus w0.

[0200] When the width of the current block is greater than the height, there may be a case where the correlation between the top reference sample and the current block is low, and in this case, horizontal linear interpolation may provide a more accurate prediction than vertical linear interpolation. Conversely, when the width of the current block is smaller than the height, there may be a case where the correlation between the left reference sample and the current block is low, and in this case, vertical linear interpolation may provide a more accurate prediction than horizontal linear interpolation. As such, by assigning a larger weight to a direction where more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected.

[0201] Alternatively, the first and second gradients described above can be expressed as G x and G yIf the number of available reference samples in the first surrounding area is different from the number of available reference samples in the second surrounding area, the weights may be determined as follows: x and / or G y may be a normalized value.

[0202]

number

[0203] According to Equation 19, when W is smaller than H, w0 is G x and G y On the other hand, when W is larger than H, w0 may be determined based on the maximum value of G x and G y When W and H are the same, w0 may be determined to be 0.5. When W and H are the same, w1 may be determined to be 1 minus w0.

[0204] When the width of the current block is greater than the height, vertical linear interpolation is more likely to produce accurate prediction because the distance to the reference sample is shorter than that of horizontal linear interpolation. Conversely, when the width of the current block is smaller than the height, horizontal linear interpolation is more likely to produce accurate prediction because the distance to the reference sample is shorter than that of vertical linear interpolation. As such, by assigning a larger weight to a direction where more accurate linear interpolation prediction is expected, improvement in prediction performance can be expected.

[0205] The weights calculated in the above-described first to third embodiments may be approximated or scaled to integers instead of decimals less than 1. For example, 2 8 When the weights are scaled by ∑ ... 7 It may be.

[0206]

number

[0207]

number

[0208] The gradient-based weight determination method described above may be adaptively used based on the difference between the first gradient and the second gradient calculated from the surrounding region. For example, if the difference between the first gradient and the second gradient is greater than or equal to a predetermined threshold, the gradient-based weight determination method may be used. On the other hand, if the difference between the first gradient and the second gradient is less than the predetermined threshold, the gradient-based weight determination method may not be used. In this case, the weights preset in the encoding device and the decoding device described above may be used.

[0209] Alternatively, the gradient-based weight determination method may be adaptively used based on the size of the current block. For example, if the size of the current block is smaller than or equal to a predetermined threshold size, the gradient-based weight determination method may be used. On the other hand, if the difference between the first gradient and the second gradient is smaller than a predetermined threshold, the gradient-based weight determination method may not be used. In this case, the weights preset in the encoding device and the decoding device may be used.

[0210] Alternatively, the gradient-based weight determination method may be adaptively used based on a flag. Here, the flag may indicate whether the gradient-based weight determination method is to be used. The flag may be coded in the encoding device and signaled to the decoding device. For example, if the flag indicates that the gradient-based weight determination method is to be used, the gradient-based weight determination method may be used. Otherwise, the gradient-based weight determination method may not be used. In this case, the weights preset in the encoding device and the decoding device may be used.

[0211] Alternatively, the gradient-based weight determination method described above may be adaptively used based on the availability of reference samples. Examples of cases where reference samples are unavailable include when all or part of the current block is located on a boundary of the current picture, when all or part of the current block is located on a boundary of a slice / tile in the current picture, when all or part of the current block is located on a boundary of a coding tree unit (CTU), when neighboring blocks of the current block are blocks coded based on inter mode, etc.

[0212] For example, if both the top reference sample and the left reference sample are available, the gradient-based weight determination method may be used. Otherwise, the gradient-based weight determination method may not be used. In this case, the weights preset in the encoding device and the decoding device described above may be used. Alternatively, if both the first and second surrounding regions are available, the gradient-based weight determination method may be used. Otherwise, the gradient-based weight determination method may not be used. In this case, the weights preset in the encoding device and the decoding device described above may be used. Alternatively, if either the first or second surrounding region is available, the gradient-based weight determination method may be used. Otherwise (i.e., if the first and second surrounding regions are not available), the gradient-based weight determination method may not be used. In this case, the weights preset in the encoding device and the decoding device described above may be used.

[0213] FIG. 5 shows a schematic configuration of the intra prediction unit 331 that performs the video decoding method according to the present disclosure.

[0214] Referring to FIG. 5, the intra prediction unit 331 may include a first predicted sample generation unit 500, a second predicted sample generation unit 510, and a weighted sum unit 520.

[0215] The first predicted sample generator 500 generates a first predicted sample for a current sample in a current block, as described above with reference to FIG.

[0216] The second predicted sample generator 510 generates a second predicted sample for the current sample, as described above with reference to FIG.

[0217] The weighted sum unit 520 may generate a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample. Here, the weights for the weighted sum may be set to the same preset weights for both the encoding apparatus and the decoding apparatus. Alternatively, the weights may be determined based on one or more gradients calculated from the surrounding areas of the current block, as described with reference to FIG. 4.

[0218] The weighted sum unit 520 may adaptively use a gradient-based weight determination method based on at least one of the difference between the first and second gradients calculated from the surrounding areas of the current block, the size of the current block, a flag, or the availability of a reference sample, as described with reference to FIG.

[0219] FIG. 6 illustrates a video encoding method performed by the encoding device according to the present disclosure.

[0220] 6, a first predicted sample for a current sample in a current block can be generated (S600). The method for generating the first predicted sample is the same as that described with reference to FIG.

[0221] 6, a second predicted sample for the current sample may be generated (S610) as described above with reference to FIG.

[0222] 6, a final predicted sample for a current sample may be generated based on a weighted sum of a first predicted sample and a second predicted sample (S620). Here, the weights for the weighted sum may be set to the same preset weights for both the encoding apparatus and the decoding apparatus. Alternatively, the weights may be determined based on one or more gradients calculated from the surrounding areas of the current block, as described with reference to FIG.

[0223] The gradient-based weight determination method may be adaptively used based on at least one of the difference between the first and second gradients calculated from the surrounding areas of the current block, the size of the current block, a flag, or the availability of a reference sample, as described with reference to FIG. 4. It may determine whether the gradient-based weight determination method is used and generate a flag indicating this. The generated flag may be coded and inserted into a bitstream.

[0224] FIG. 7 shows a schematic configuration of the intra prediction unit 222 that performs the video encoding method according to the present disclosure.

[0225] Referring to FIG. 7, the intra prediction unit 222 may include a first predicted sample generation unit 700, a second predicted sample generation unit 710, and a weighted sum unit 720.

[0226] The first predicted sample generator 700 generates a first predicted sample for a current sample in a current block, as described above with reference to FIG.

[0227] The second predicted sample generator 710 generates a second predicted sample for the current sample, as described above with reference to FIG.

[0228] The weighted sum unit 720 may generate a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample. Here, the weights for the weighted sum may be set to the same preset weights for both the encoding apparatus and the decoding apparatus. Alternatively, the weights may be determined based on one or more gradients calculated from neighboring regions of the current block, as described with reference to FIG. 4.

[0229] The weighted sum unit 720 may adaptively use a gradient-based weight determination method based on at least one of the difference between the first and second gradients calculated from the surrounding areas of the current block, the size of the current block, a flag, or the availability of a reference sample, as described with reference to FIG.

[0230] The intra predictor 222 may determine whether the gradient-based weighting method is used and generate a flag indicating this, which may be coded and inserted into the bitstream.

[0231] In the above-described embodiments, the method is described based on a flowchart with a series of steps or blocks, but the embodiment is not limited to the order of the steps, and some steps may occur in a different order or simultaneously with other steps than those described above. Furthermore, those skilled in the art will understand that the steps shown in the flowchart are not exclusive, and other steps may be included, or one or more steps of the flowchart may be deleted without affecting the scope of the embodiments of this document.

[0232] The methods according to the embodiments of the present document described above may be implemented in the form of software, and the encoding device and / or decoding device according to the present document may be included in a device that performs video processing, such as a TV, a computer, a smartphone, a set-top box, or a display device.

[0233] When embodiments in this document are embodied as software, the methods described above may be embodied as modules (processes, functions, etc.) that perform the functions described above. The modules may be stored in memory and executed by a processor. The memory may be internal or external to the processor and may be coupled to the processor by various 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 read-only memory (ROM), random access memory (RAM), flash memory, a memory card, a storage medium, and / or other storage devices. That is, the embodiments described herein may be embodied and executed on a processor, microprocessor, controller, or chip. For example, the functional units illustrated in the figures may be embodied and executed on a computer, processor, microprocessor, controller, or chip. In this case, information (e.g., information on instructions) or algorithms for the implementation may be stored on a digital storage medium.

[0234] In addition, the decoding device and encoding device to which the embodiments of the present specification are applied may be included in a multimedia broadcast transmitting / receiving device, a mobile communication terminal, a home cinema video device, a digital cinema video device, a surveillance camera, a video conversation device, a real-time communication device such as video communication, a mobile streaming device, a storage medium, a camcorder, a custom video (VoD) service providing device, an over-the-top (OTT) video (over-the-top) device, an internet streaming service providing device, a three-dimensional (3D) video device, a virtual reality (VR) device, an augmented reality (AR) device, a video telephone video device, a vehicle terminal (e.g., a vehicle terminal (including an autonomous vehicle), an airplane terminal, a ship terminal, etc.), a medical video device, etc., and may be used to process video signals or data signals. For example, over-the-top (OTT) video (over-the-top) video devices may include a game console, a Blu-ray player, an internet-connected TV, a home theater system, a smartphone, a tablet PC, a digital video recorder (DVR), etc.

[0235] In addition, a processing method to which the embodiments of the present specification are applied may be produced in the form of a program executed by a computer and stored in a computer-readable recording medium. Multimedia data having a data structure according to the embodiments of the present specification may also be stored in a computer-readable recording medium. The computer-readable recording medium may include any type of storage device or distributed storage device in which computer-readable data is stored. The computer-readable recording medium may include, for example, a Blu-ray Disc (BD), a Universal Serial Bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. The computer-readable recording medium may also include media embodied in the form of a carrier wave (e.g., transmission via the Internet). In addition, a bitstream generated by the encoding method may be stored in a computer-readable recording medium or transmitted via a wired or wireless communication network.

[0236] Furthermore, the embodiments of the present specification may be embodied as a computer program product using program code, which may be executed by a computer according to the embodiments of the present specification. The program code may be stored on a computer-readable carrier.

[0237] FIG. 8 illustrates an example of a content streaming system to which the embodiments of the present disclosure can be applied.

[0238] Referring to FIG. 8, a content streaming system to which the embodiments of the present specification are applied may broadly include an encoding server, a streaming server, a web server, a media storage, a user device, and a multimedia input device.

[0239] The encoding server compresses content input from a multimedia input device such as a smartphone, camera, camcorder, etc. into digital data to generate a bitstream and transmits the bitstream to the streaming server. As another example, if a multimedia input device such as a smartphone, camera, camcorder, etc. directly generates a bitstream, the encoding server may be omitted.

[0240] The bitstream may be generated by an encoding method or a bitstream generation method to which the embodiments of this specification are applied, and the streaming server may temporarily store the bitstream during the process of transmitting or receiving the bitstream.

[0241] The streaming server transmits multimedia data to a user device based on a user request via a web server, and the web server acts as an intermediary to inform the user of available services. When a user requests a desired service from the web server, the web server transmits the request to the streaming server, which then transmits the multimedia data to the user. In this case, the content streaming system may include a separate control server, which controls commands and responses between devices in the content streaming system.

[0242] The streaming server can receive content from a media storage and / or encoding server. For example, when receiving content from the encoding server, the content can be received in real time. In this case, the streaming server can store the bitstream for a certain period of time to provide a smooth streaming service.

[0243] Examples of the user devices include mobile phones, smartphones, laptop computers, digital broadcasting terminals, personal digital assistants (PDAs), portable multimedia players (PMPs), navigation systems, slate PCs, tablet PCs, ultrabooks, wearable devices (e.g., smartwatches, smart glasses, and head-mounted displays (HMDs)), digital TVs, desktop computers, and digital signage.

[0244] Each server in the content streaming system may be operated as a distributed server, in which case data received by each server may be processed in a distributed manner.

[0245] The claims described herein may be combined in various ways. For example, technical features of method claims herein may be combined and embodied as an apparatus, and technical features of apparatus claims herein may be combined and embodied as a method. Furthermore, technical features of method claims herein and technical features of apparatus claims herein may be combined and embodied as an apparatus, and technical features of method claims herein and technical features of apparatus claims herein may be combined and embodied as a method.

[0246] [Claims at the time of international application] [Claim 1] A video decoding method, comprising: generating a first predicted sample for a current sample in the current block based on a left reference sample of the current block; generating a second predicted sample for the current sample based on an upper reference sample of the current block; generating a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample; the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample; The first weight is determined based on one or more gradients calculated from a surrounding area of ​​the current block. [Claim 2] the gradient calculated from the surrounding region includes a first gradient and a second gradient; The peripheral area is divided into a first peripheral area and a second peripheral area, the first surrounding area is an area including one or more reference samples belonging to an upper-end surrounding block of the current block, 2. The video decoding method of claim 1, wherein the second surrounding area is an area including one or more reference samples belonging to a left-side surrounding block of the current block. [Claim 3] the first gradient is derived based on one or more gradients calculated from a first surrounding region of the current block; 3. The image decoding method of claim 2, wherein the second gradient is derived based on one or more gradients calculated by applying the one-dimensional filter to a second surrounding region of the current block. [Claim 4] the first gradient is derived based on one or more horizontal gradients calculated from a first surrounding region of the current block; 3. The video decoding method of claim 2, wherein the second gradient is derived based on one or more vertical gradients calculated from a second surrounding region of the current block. [Claim 5] the first gradient is derived based on one or more horizontal gradients calculated from a first surrounding region of the current block and one or more horizontal gradients calculated from a second surrounding region of the current block; 3. The image decoding method of claim 2, wherein the second gradient is derived based on one or more vertical gradients calculated from a first surrounding region of the current block and one or more vertical gradients calculated from a second surrounding region of the current block. [Claim 6] The video decoding method of claim 2 , wherein the first weight is determined based on whether the first gradient is smaller than a second gradient. [Claim 7] if the first gradient is smaller than the second gradient, the first weight is determined based on a maximum value of the first gradient and the second gradient; 7. The video decoding method of claim 6, wherein if the first gradient is greater than or equal to the second gradient, the first weight is determined based on a minimum value of the first gradient and the second gradient. [Claim 8] if the first gradient is greater than or equal to the second gradient, the first weight is determined based on a maximum value of the first gradient and the second gradient; 7. The video decoding method of claim 6, wherein if the first gradient is smaller than the second gradient, the first weight is determined based on a minimum value of the first gradient and the second gradient. [Claim 9] 3. The image decoding method of claim 2, wherein the first weight is determined based on at least one of whether a width of the current block is greater than a height of the current block, or whether a width and a height of the current block are the same. [Claim 10] When the width of the current block is smaller than the height of the current block, the first weight is determined based on a maximum value of the first gradient and the second gradient; 10. The image decoding method of claim 9, wherein, if the width of the current block is greater than or equal to the height of the current block, the first weight is determined based on a minimum value of the first gradient and the second gradient. [Claim 11] When the width of the current block is greater than or equal to the height of the current block, the first weight is determined based on a maximum value of the first gradient and the second gradient; 10. The image decoding method of claim 9, wherein if the width of the current block is smaller than the height of the current block, the first weight is determined based on a minimum value of the first gradient and the second gradient. [Claim 12] 2. The video decoding method of claim 1, wherein the one or more gradient-based weights are adaptively determined based on at least one of a difference between gradients calculated from the surrounding regions, a size of the current block, a flag, or availability of reference samples in the surrounding regions. [Claim 13] 1. A video encoding method, comprising: generating a first predicted sample for a current sample in the current block based on a left reference sample of the current block; generating a second predicted sample for the current sample based on an upper reference sample of the current block; generating a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample; the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample; The first weight is determined based on one or more gradients calculated from a surrounding area of ​​the current block. [Claim 14] A computer-readable recording medium, comprising: A computer-readable recording medium storing a bitstream generated by the video encoding method of claim 11. [Claim 15] 1. A data transmission method, comprising: obtaining a bitstream for video information; the bitstream is generated by generating a first predicted sample for a current sample in a current block based on a left reference sample of the current block, generating a second predicted sample for the current sample based on an upper reference sample of the current block, and generating a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample; transmitting data including said bitstream; the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample; A data transmission method, wherein the first weight value is determined based on one or more gradients calculated from surrounding areas of the current block.

Claims

1. A video decoding method, comprising: generating a first predicted sample for a current sample in the current block based on a left reference sample of the current block; generating a second predicted sample for the current sample based on an upper reference sample of the current block; generating a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample; the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample; The first weight is determined based on one or more gradients calculated from a neighboring region of the current block.

2. the gradient calculated from the surrounding region includes a first gradient and a second gradient; The peripheral region is divided into a first peripheral region and a second peripheral region, the first surrounding area is an area including one or more reference samples belonging to an upper-end surrounding block of the current block, The image decoding method of claim 1 , wherein the second surrounding area is an area including one or more reference samples belonging to a left-side surrounding block of the current block.

3. the first gradient is derived based on one or more gradients calculated from a first surrounding region of the current block; The image decoding method of claim 2 , wherein the second gradient is derived based on one or more gradients calculated by applying the one-dimensional filter to a second surrounding region of the current block.

4. the first gradient is derived based on one or more horizontal gradients calculated from a first surrounding region of the current block; The image decoding method of claim 2 , wherein the second gradient is derived based on one or more vertical gradients calculated from a second surrounding region of the current block.

5. the first gradient is derived based on one or more horizontal gradients calculated from a first peripheral region of the current block and one or more horizontal gradients calculated from a second peripheral region of the current block; 3. The image decoding method of claim 2, wherein the second gradient is derived based on one or more vertical gradients calculated from a first peripheral region of the current block and one or more vertical gradients calculated from a second peripheral region of the current block.

6. The video decoding method of claim 2 , wherein the first weight is determined based on whether the first gradient is smaller than a second gradient.

7. If the first gradient is smaller than the second gradient, the first weight is determined based on a maximum value of the first gradient and the second gradient; The video decoding method of claim 6 , wherein if the first gradient is greater than or equal to the second gradient, the first weight is determined based on a minimum value of the first gradient and the second gradient.

8. if the first gradient is greater than or equal to the second gradient, the first weight is determined based on a maximum value of the first gradient and the second gradient; The image decoding method of claim 6 , wherein if the first gradient is smaller than the second gradient, the first weight is determined based on a minimum value of the first gradient and the second gradient.

9. 3. The image decoding method of claim 2, wherein the first weight is determined based on at least one of whether a width of the current block is greater than a height of the current block, or whether a width and a height of the current block are the same.

10. When the width of the current block is smaller than the height of the current block, the first weight is determined based on a maximum value of the first gradient and the second gradient; 10. The image decoding method of claim 9, wherein if the width of the current block is greater than or equal to the height of the current block, the first weight is determined based on a minimum value of the first gradient and the second gradient.

11. If the width of the current block is greater than or equal to the height of the current block, the first weight is determined based on a maximum value of the first gradient and the second gradient; 10. The image decoding method of claim 9, wherein if the width of the current block is smaller than the height of the current block, the first weight is determined based on a minimum value of the first gradient and the second gradient.

12. 2. The video decoding method of claim 1, wherein the one or more gradient-based weights are adaptively determined based on at least one of a difference between gradients calculated from the surrounding regions, a size of the current block, a flag, or availability of reference samples in the surrounding regions.

13. 1. A video encoding method, comprising: generating a first predicted sample for a current sample in the current block based on a left reference sample of the current block; generating a second predicted sample for the current sample based on an upper reference sample of the current block; generating a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample; the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample; The first weight is determined based on one or more gradients calculated from a surrounding area of ​​the current block.

14. A computer-readable recording medium, comprising: A computer-readable recording medium storing a bitstream generated by the video encoding method of claim 11.

15. 1. A data transmission method, comprising: obtaining a bitstream for video information; the bitstream is generated by generating a first predicted sample for a current sample in a current block based on a left reference sample of the current block, generating a second predicted sample for the current sample based on an upper reference sample of the current block, and generating a final predicted sample for the current sample based on a weighted sum of the first predicted sample and the second predicted sample, transmitting data including said bitstream; the weights for the weighted sum include a first weight applied to the first predicted sample and a second weight applied to the second predicted sample; The data transmission method, wherein the first weight value is determined based on one or more gradients calculated from surrounding areas of the current block.