Image encoding / decoding method, apparatus and recording medium storing bitstream

By using a brightness compensation method, a prediction block is generated by weighted summation of multiple template shapes and weights. This solves the problem of transmission and storage costs caused by the increased data volume of high-resolution images and improves image encoding/decoding efficiency.

CN122460076APending Publication Date: 2026-07-24HYUNDAI MOTOR CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HYUNDAI MOTOR CO LTD
Filing Date
2024-10-17
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

With the increasing volume of high-resolution, high-quality image data, existing transmission and storage costs are rising, necessitating improvements in image encoding/decoding efficiency.

Method used

A brightness compensation method is adopted. By determining the brightness compensation parameters of the current block and the reference block, a prediction block is generated. The final prediction block is generated by weighted summation of multiple template shape candidates.

Benefits of technology

This improves the accuracy of inter-frame prediction, thereby enhancing overall coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122460076A_ABST
    Figure CN122460076A_ABST
Patent Text Reader

Abstract

A method and apparatus of image encoding / decoding, a recording medium storing a bitstream, and a transmission method are provided. The image decoding method can include determining at least one reference block for a current block from reference pictures, determining at least one illumination compensation parameter based on a current template for the current block and at least one reference template for the at least one reference block, generating at least one prediction block by modifying samples of the at least one reference block based on the at least one illumination compensation parameter, and generating a final prediction block for the current block based on the at least one prediction block, wherein the at least one reference template has a shape determined from a plurality of template shape candidates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to methods and apparatus for encoding / decoding images, and recording media for storing bitstreams. Specifically, this invention relates to methods and apparatus for encoding / decoding images based on inter-frame prediction methods, and recording media for storing bitstreams. Background Technology

[0002] Recently, the demand for high-resolution, high-quality images, such as ultra-high-definition (UHD) images, has been increasing across various application areas. As image data becomes higher in resolution and quality, the relative volume of data increases compared to existing image data. Therefore, transmission and storage costs increase when using media such as existing wired and wireless broadband lines to transmit image data or when using existing storage media to store image data. To address these issues arising from the increasing resolution and quality of image data, efficient image encoding / decoding technologies with higher resolution and quality are needed.

[0003] Brightness compensation is a prediction method that models the brightness variation between the templates of the current block and the reference block to estimate the relationship between the two blocks. Improving prediction methods through brightness compensation can increase the coding efficiency of the current image. Therefore, various methods to improve prediction accuracy through brightness compensation are being discussed. Summary of the Invention

[0004] Technical issues

[0005] The purpose of this invention is to provide a method and apparatus for encoding / decoding images with improved encoding / decoding efficiency.

[0006] Another object of the present invention is to provide a recording medium for storing a bitstream generated by a method or apparatus for decoding images according to the present invention.

[0007] Technical solution

[0008] An image decoding method may include: determining at least one reference block of a current block from a reference image; determining at least one brightness compensation parameter based on a current template of the current block and at least one reference template for the at least one reference block; generating at least one prediction block by modifying samples of the at least one reference block based on the at least one brightness compensation parameter; and generating a final prediction block of the current block based on the at least one prediction block. The at least one reference template may have a shape determined from a plurality of template shape candidates.

[0009] Multiple template shape candidates may include: a first template shape, including a sample adjacent to the left side of the current block; a second template shape, including a sample adjacent to the top of the current block; and a third template shape, including a sample adjacent to the left side of the current block and a sample adjacent to the top of the current block.

[0010] The at least one reference block can be derived from the motion vector of the current block.

[0011] The at least one reference block may include a first reference block and a second reference block.

[0012] At least one reference template may include a first reference template and a second reference template, wherein the first reference template includes samples adjacent to the first reference block and the second reference template includes samples adjacent to the second reference block.

[0013] The first reference template and the second reference template can have the same shape.

[0014] The first reference template and the second reference template may have different shapes.

[0015] At least one brightness compensation parameter may include a first brightness compensation parameter indicating a first linear model between the current template and the first reference template, and a second brightness compensation parameter indicating a second linear model between the current template and the second reference template.

[0016] The predicted block for the current block can be generated using a first weight determined based on a first reference template and a second weight determined based on a second reference template.

[0017] The first and second weights can be determined based on the first distortion between the current template and the first reference template and the second distortion between the current template and the second reference template.

[0018] The first weight can increase as the second distortion increases, and the second weight can increase as the first distortion increases.

[0019] The predicted block for the current block can be generated by weighted summation of samples from at least one reference block with a first weight and samples from at least one reference block with a second weight.

[0020] The predicted block of the current block can be generated by modifying the samples of at least one reference block using a final brightness compensation parameter, which is generated based on a weighted sum of a first brightness compensation parameter with a first weight and a second brightness compensation parameter with a second weight.

[0021] An image encoding method may include: determining a first reference block and a second reference block for a current block based on a current image; determining a current template for the current block, a first brightness compensation parameter for the first reference template of the first reference block, and a second brightness compensation parameter for the second reference template of the current template and the second reference block; modifying a first prediction block derived from the first reference block based on the first brightness compensation parameter; modifying a second prediction block derived from the second reference block based on the second brightness compensation parameter; and determining a final prediction block for the current block based on the modified first prediction block and the modified second prediction block.

[0022] A non-transitory computer-readable recording medium for storing a bitstream generated by an image encoding method according to an embodiment of the present invention, the image encoding method comprising: determining a first reference block and a second reference block of a current block from a current frame; determining a current template of the current block, a first brightness compensation parameter of the first reference template of the first reference block, and a second brightness compensation parameter of the second reference template of the current template and the second reference block; modifying a first prediction block derived from the first reference block according to the first brightness compensation parameter; modifying a second prediction block derived from the second reference block according to the second brightness compensation parameter; and determining a final prediction block of the current block based on the modified first prediction block and the modified second prediction block.

[0023] A method for transmitting a bitstream generated by an image encoding method according to an embodiment of the present invention may include encoding an image based on the image encoding method and transmitting the bitstream. The image encoding method may include: determining a current template of the current block, a first brightness compensation parameter of a first reference template of a first reference block, and a second brightness compensation parameter of a second reference template of a current template and a second reference block; modifying a first prediction block derived from the first reference block according to the first brightness compensation parameter; modifying a second prediction block derived from the second reference block according to the second brightness compensation parameter; and determining a final prediction block of the current block based on the modified first prediction block and the modified second prediction block.

[0024] The features briefly summarized above are merely exemplary aspects of the following detailed description of the present disclosure and do not limit the scope of the disclosure.

[0025] Beneficial effects

[0026] This invention proposes various embodiments of a brightness compensation method using at least one template.

[0027] This invention proposes various embodiments of a method for using the predicted values ​​of at least one template fusion brightness compensation method.

[0028] Furthermore, the present invention proposes various embodiments of a method for determining the brightness compensation parameters required for a brightness compensation method using at least one template.

[0029] According to various embodiments, improving the accuracy of inter-frame prediction can improve overall coding efficiency. Attached Figure Description

[0030] Figure 1 This is a block diagram illustrating the configuration of an encoding device according to an embodiment of the present invention.

[0031] Figure 2 This is a block diagram illustrating the configuration of a decoding device according to an embodiment of the present invention.

[0032] Figure 3 This is a schematic diagram illustrating a video encoding system to which the present invention can be applied.

[0033] Figure 4 This is a diagram illustrating the method for determining a reference block and a reference template in a brightness compensation method according to an embodiment of the present invention.

[0034] Figure 5 This is a diagram illustrating a method for determining multiple reference blocks and reference templates in a brightness compensation method according to an embodiment of the present invention.

[0035] Figure 6 This is a diagram illustrating a plurality of template shape candidates used in a brightness compensation method according to an embodiment of the present invention.

[0036] Figure 7 An implementation of an inter-frame prediction method based on a brightness compensation method using at least one template is shown.

[0037] Figure 8 An exemplary content streaming system applicable according to an embodiment of the present invention is shown. Detailed Implementation

[0038] This invention can have various modifications and embodiments, and specific embodiments are shown in the accompanying drawings and described in detail in the detailed description. However, this is not intended to limit the invention to the specific embodiments, but should be understood to include all modifications, equivalents, or substitutions included within the spirit and scope of the invention. In various aspects, similar reference numerals in the drawings indicate the same or similar functions. The shapes and dimensions of the elements in the drawings are provided by way of example for clearer description. The detailed description of exemplary embodiments described below refers to the accompanying drawings, which illustrate specific embodiments by way of example. These embodiments are described in sufficient detail to enable those skilled in the art to practice them. It should be understood that the various embodiments differ from one another but are not necessarily mutually exclusive. For example, the particular shapes, structures, and characteristics described herein may be implemented in other embodiments without departing from the spirit and scope of the invention with respect to one embodiment. It should also be understood that the position or arrangement of the various components in each disclosed embodiment may be changed without departing from the spirit and scope of the embodiments. Therefore, the specific embodiments set forth below are not intended to be limiting, and the scope of the exemplary embodiments is defined only by the appended claims and the full scope of the equivalents to which those claims are entitled (if appropriately described).

[0039] In this invention, the terms first, second, etc., may be used to describe various components, but these components should not be limited by these terms. These terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of this invention, a first component may be referred to as a second component, and similarly, a second component may be referred to as a first component. The term is and / or includes a combination of or any of a plurality of related descriptive terms.

[0040] The components in the embodiments of the present invention are described independently to indicate different functional features, which does not mean that each component is formed as a separate hardware or software configuration unit. That is, for ease of explanation, each component is listed and included as a separate component, and at least two components can be combined to form a single component, or a component can be divided into multiple components to perform functions. Embodiments in which components are integrated and embodiments in which each component is divided are also included within the scope of the present invention, provided that they do not depart from the spirit of the present invention.

[0041] The terminology used in this invention is for describing specific embodiments only and is not intended to limit the invention. Singular expressions include plural expressions unless the context clearly indicates otherwise. Furthermore, some components of this invention are not essential for performing the basic functions of this invention and may be optional components used only to improve performance. This invention can be implemented by including only the essential components necessary to achieve the essence of the invention, excluding components used only to improve performance, and structures that include only the essential components other than optional components used only to improve performance are also included within the scope of this invention.

[0042] In one implementation, the term "at least one" may refer to one of a number greater than or equal to 1, such as 1, 2, 3, and 4. In one implementation, the term "a plurality of" may refer to one of a number greater than or equal to 2, for example, 2, 3, and 4.

[0043] Hereinafter, embodiments of the present invention will be specifically described with reference to the accompanying drawings. In describing the embodiments of this specification, if a detailed description of a related known configuration or function is determined to be likely to obscure the subject matter of this specification, a detailed description will be omitted, and the same reference numerals will be used for the same parts in the drawings, and repeated descriptions of the same parts will be omitted.

[0044] Description of terms

[0045] In the following text, “image” can refer to a picture that constitutes a video, or it can refer to the video itself. For example, “encoding and / or decoding of an image” can mean “encoding and / or decoding of a video,” and it can also mean “encoding and / or decoding of one of the images that constitutes a video.”

[0046] In the following text, "moving image" and "video" can be used with the same meaning and can be used interchangeably. Additionally, the target image can be an encoded target image that is the target of encoding and / or a decoded target image that is the target of decoding. Furthermore, the target image can be an input image to an encoding device and can also be an input image to a decoding device. Here, the target image can have the same meaning as the current image.

[0047] In the following text, “image,” “picture,” “frame,” and “picture” can be used with the same meaning and can be used interchangeably.

[0048] In the following text, "target block" can be an encoded target block that serves as the encoding target and / or a decoded target block that serves as the decoding target. Additionally, a target block can be the current block that serves as the target of the current encoding and / or decoding. For example, "target block" and "current block" can be used with the same meaning and can be used interchangeably.

[0049] Hereinafter, "block" and "unit" may be used with the same meaning and may be used interchangeably. In addition, a "unit" may refer to a unit including a luminance component block and a corresponding chrominance component block to distinguish it from a block. For example, a coding tree unit (CTU) may be composed of one luminance component (Y) coding tree block (CTB) and two chrominance component (Cb, Cr) coding tree blocks associated therewith.

[0050] Hereinafter, "sample", "picture element", and "pixel" may be used with the same meaning and may be used interchangeably. In this document, a sample may refer to a basic unit constituting a block.

[0051] Hereinafter, "inter" and "inter-picture" may be used with the same meaning and may be used interchangeably.

[0052] Hereinafter, "intra" and "intra-picture" may be used with the same meaning and may be used interchangeably.

[0053] Figure 1 FIG. [0000132] is a block diagram showing the configuration of an encoding device according to an embodiment of the present invention.

[0054] The encoding device 100 may be an encoder, a video encoding device, or an image encoding device. A video may include one or more images. The encoding device 100 may sequentially encode one or more images.

[0055] Referring to Figure 1 , the encoding device 100 may include an image segmentation unit 110, an intra prediction unit 120, a motion prediction unit 121, a motion compensation unit 122, a switch 115, a subtractor 113, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, an inverse quantization unit 160, an inverse transform unit 170, an adder 117, a filter unit 180, and a reference picture buffer 190.

[0056] In addition, the encoding device 100 may generate a bitstream including information encoded by encoding an input image, and output the generated bitstream. The generated bitstream may be stored in a computer-readable recording medium, or may be streamed through a wired / wireless transmission medium.

[0057] Image segmentation unit 110 can segment the input image into various forms to improve the efficiency of video encoding / decoding. That is, the input video consists of multiple images, and an image can be segmented and processed hierarchically for compression efficiency, parallel processing, etc. For example, an image can be segmented into one or more tiles or slices, and then further segmented into multiple CTUs (Code Tree Units). Alternatively, an image can first be segmented into multiple sub-images defined as groups of rectangular slices, and each sub-image can be segmented into tiles / slices. Here, sub-images can be used to support partially independent encoding / decoding and image transmission. Since multiple sub-images can be reconstructed individually, it has the advantage of easy editing in applications that configure multi-channel input into a single image. Furthermore, tiles can be horizontally partitioned to generate bricks. Here, bricks can be used as the basic unit for parallel processing within an image. Additionally, a CTU can be recursively segmented into a quadtree (QT), and the segmented terminal nodes can be defined as CUs (Compiler Units). A CTU can be partitioned into PUs (prediction units) as prediction units and TUs (transformation units) as transformation units to perform prediction and partitioning. Simultaneously, a CU can be used as both a prediction unit and / or a transformation unit itself. Here, for flexible partitioning, each CTU can be recursively partitioned into a multi-type tree (MTT) and a quadtree (QT). The partitioning of a CTU into a multi-type tree can start from the end node of the QT, and the MTT can consist of binary trees (BT) and ternary trees (TT). For example, the MTT structure can be classified into vertical binary partitioning pattern (SPLIT_BT_VER), horizontal binary partitioning pattern (SPLIT_BT_HOR), vertical ternary partitioning pattern (SPLIT_TT_VER), and horizontal ternary partitioning pattern (SPLIT_TT_HOR). Additionally, during the segmentation, the minimum block size (MinQTSize) of the quadtree for the luma block can be set to 16x16, the maximum block size (MaxBtSize) of the binary tree can be set to 128x128, and the maximum block size (MaxTtSize) of the ternary tree can be set to 64x64. Furthermore, the minimum block sizes (MinBtSize) of the binary tree and the minimum block size (MinTtSize) of the ternary tree can be specified as 4x4, and the maximum depth (MaxMttDepth) of the multi-type tree can be specified as 4. Moreover, to improve the coding efficiency of the I-strip, a dual-tree CTU segmentation structure using different luma and chroma components can be applied. On the other hand, in P and B slices, the luma and chroma CTBs (decoding tree blocks) within the CTU can be segmented into a single tree sharing a decoding tree structure.

[0058] Encoding device 100 can encode the input image in intra-frame mode and / or inter-frame mode. Optionally, encoding device 100 can encode the input image in a third mode other than intra-frame mode and inter-frame mode (e.g., IBC mode, palette mode, etc.). However, if the third mode has similar functional characteristics to the intra-frame mode or inter-frame mode, it can be classified as an intra-frame mode or inter-frame mode for ease of explanation. In this invention, the third mode is classified and described separately only when a specific description is required.

[0059] When the intra-frame mode is used as the prediction mode, switch 115 can be switched to intra-frame, and when the inter-frame mode is used as the prediction mode, switch 115 can be switched to inter-frame. Here, intra-frame mode can refer to intra-frame prediction mode, and inter-frame mode can refer to inter-frame prediction mode. Encoding device 100 can generate prediction blocks for input blocks of the input image. Additionally, encoding device 100 can encode residual blocks using the residual between the input block and the prediction block after generating the prediction blocks. The input image can be referred to as the current image of the current coding target. The input block can be referred to as the current block of the current coding target or the coding target block.

[0060] When the prediction mode is intra-frame mode, the intra-frame prediction unit 120 can use samples from blocks that have already been encoded / decoded around the current block as reference samples. The intra-frame prediction unit 120 can perform spatial prediction on the current block using the reference samples, or generate prediction samples for the input block through spatial prediction. Here, intra-frame prediction can refer to intra-frame prediction.

[0061] As an intra-frame prediction method, non-directional prediction modes and directional prediction modes (e.g., 65 directions) such as DC mode and planar mode can be applied. Here, the intra-frame prediction method can be represented as an intra-frame prediction mode or an intra-frame prediction mode.

[0062] When the prediction mode is inter-frame mode, the motion prediction unit 121 can search for the region that best matches the input block from the reference image during motion prediction processing, and derive the motion vector using the searched region. In this case, the searched region can be used as the target region. The reference image can be stored in the reference image buffer 190. Here, when encoding / decoding is performed on the reference image, it can be stored in the reference image buffer 190.

[0063] The motion compensation unit 122 can generate a prediction block for the current block by performing motion compensation using motion vectors. Here, inter-frame prediction can refer to inter-picture prediction or motion compensation.

[0064] When the value of the motion vector is not an integer, the motion prediction unit 121 and the motion compensation unit 122 can generate prediction blocks by applying an interpolation filter to a portion of the reference frame. To perform inter-frame prediction or motion compensation, it can be determined whether the motion prediction and motion compensation mode of the prediction unit included in the compilation unit is one of skip mode, merge mode, advanced motion vector prediction (AMVP) mode, and compilation unit-based intra-block copy (IBC) mode, and inter-frame prediction or motion compensation can be performed according to each mode.

[0065] Furthermore, based on the aforementioned inter-frame prediction methods, the following modes can be applied: AFFINE mode based on sub-PU prediction, SbTMVP (sub-block temporal motion vector prediction), MMVD (merged with MVD) mode based on PU prediction, and GPM (geometric segmentation mode). In addition, to improve the performance of each mode, HMVP (history-based MVP), PAMVP (pairwise averaged MVP), C11P (combined intra / inter-frame prediction), AMVR (adaptive motion vector resolution), BDOF (bidirectional optical flow), BCW (bidirectional prediction with CU weights), LIC (local luminance compensation), TM (template matching), and OBMC (overlapping block motion compensation).

[0066] Subtractor 113 can generate a residual block by using the difference between the input block and the prediction block. The residual block can be referred to as the residual signal. The residual signal can represent the difference between the original signal and the prediction signal. Alternatively, the residual signal can be a signal generated by transforming or quantizing, or transforming and quantizing the difference between the original signal and the prediction signal. The residual block can be the residual signal of a block cell.

[0067] Transform unit 130 can generate transform coefficients by performing a transform on the residual block and output the generated transform coefficients. Here, the transform coefficients can be coefficient values ​​generated by performing a transform on the residual block. When a transform skip mode is applied, transform unit 130 can skip the transform of the residual block.

[0068] A quantized level can be generated by applying quantization to the transform coefficients or the residual signal. In the following examples, the quantized level may also be referred to as the transform coefficients.

[0069] For example, a 4x4 lumen residual block generated by intra-frame prediction can be transformed using a base vector based on DST (Discrete Sine Transform), and the remaining residual blocks can be transformed using a base vector based on DCT (Discrete Cosine Transform). Furthermore, the Residual Quad Tree (RQT) technique is used to partition the transformed block into a quadtree shape for each block, and after performing transformation and quantization on each transformed block partitioned by RQT, a compiled block flag (cbf) can be sent when all coefficients become 0 to increase coding efficiency.

[0070] As an alternative, the Multiple Transform Selection (MTS) technique can be applied, which selectively uses multiple transform bases to perform the transform. That is, instead of segmenting the CU into TUs via RQT, a similar function to TU segmentation can be performed using the Sub-Block Transform (SBT) technique. Specifically, SBT is applied only to inter-frame prediction blocks, and unlike RQT, the current block can be segmented into 1 / 2 or 1 / 4 of its size vertically or horizontally, and then the transform can be performed on only one block. For example, if it is segmented vertically, the transform can be performed on the leftmost or rightmost block, and if it is segmented horizontally, the transform can be performed on the topmost or bottommost block.

[0071] Additionally, Low Frequency Non-Separable Transform (LFNST) can be applied. LFNST is a secondary transformation technique that transforms the residual signal transformed to the frequency domain by DCT or DST. LFNST also performs the transformation on the upper left 4x4 or 8x8 low-frequency region, allowing the residual coefficients to be concentrated in the upper left.

[0072] The quantization unit 140 can generate a quantization level by quantizing the transform coefficients or residual signal according to the quantization parameters (QP), and output the generated quantization level. Here, the quantization unit 140 can quantize the transform coefficients using a quantization matrix.

[0073] For example, a quantizer with a QP value of 0 to 51 can be used. Alternatively, if the image size is large and high coding efficiency is required, a QP value of 0 to 63 can be used. Furthermore, a DQ (correlated quantization) method using two quantizers instead of one can be applied. DQ performs quantization using two quantizers (e.g., Q0 and Q1), but even without signaling information about a particular quantizer, the quantizer used for the next transform coefficient can be selected based on the current state via a state transition model.

[0074] Entropy coding unit 150 can generate and output a bitstream by performing entropy coding on values ​​calculated by quantization unit 140 or on coding parameter values ​​calculated during encoding according to a probability distribution. Entropy coding unit 150 can perform entropy coding on information about samples of the image and information for decoding the image. For example, information for decoding the image may include syntax elements.

[0075] When entropy coding is applied, symbols are represented such that fewer bits are allocated to symbols with high occurrence probabilities and more bits are allocated to symbols with low occurrence probabilities, and thus the size of the bitstream used to encode the symbols can be reduced. The entropy coding unit 150 can perform entropy coding using coding methods such as exponential Golomb, context-adaptive variable-length coding (CAVLC), context-adaptive binary arithmetic coding (CABAC), etc. For example, the entropy coding unit 150 can perform entropy coding by using a variable-length coding / encoding (VLC) table. Alternatively, the entropy coding unit 150 can derive a binaryization method for the target symbols and a probabilistic model for the target symbol / bin, and perform arithmetic coding by using the derived binaryization method and context model.

[0076] Relatedly, when applying CABAC, in order to reduce the size of the probability table stored in the decoding device, the table probability update method can be changed to a table update method using simple equations and applied. Furthermore, two different probability models can be used to obtain more accurate symbol probability values.

[0077] In order to encode the transform coefficient level (quantization level), the entropy coding unit 150 can change the two-dimensional block form coefficients into one-dimensional vector form through the transform coefficient scanning method.

[0078] The encoding parameters may include information (flags, indexes, etc.) (such as syntax elements) encoded in the encoding device 100 and signaled to the decoding device 200, and information derived in the encoding or decoding process, and may represent the information required when encoding or decoding an image.

[0079] Here, sending a flag or index with a signal can indicate that the corresponding flag or index is entropy encoded in the encoder and included in the bitstream, and can also indicate that the corresponding flag or index is entropy decoded from the bitstream in the decoder.

[0080] The encoded current image can be used as a reference image for another image to be processed later. Therefore, the encoding device 100 can reconstruct or decode the encoded current image again and store the reconstructed or decoded image as a reference image in the reference image buffer 190.

[0081] The quantization level can be dequantized in inverse quantization unit 160 or inverse transformed in inverse transform unit 170. The coefficients of the dequantization and / or inverse transform can be added to the prediction block via adder 117. Here, the coefficients of the dequantization and / or inverse transform can refer to the coefficients to which at least one of dequantization and inverse transform is performed, and can refer to the reconstructed residual block. Inverse quantization unit 160 and inverse transform unit 170 can be performed as the inverse of quantization unit 140 and transform unit 130.

[0082] The reconstructed blocks can pass through filter unit 180. Filter unit 180 can apply all or some filtering techniques, such as deblocking filters, sample adaptive offset (SAO), adaptive loop filters (ALF), bilateral filters (BIF), luma mapping with chroma scaling (LMCS), etc., to the reconstructed samples, reconstructed blocks, or reconstructed images. Filter unit 180 may be referred to as an in-loop filter. In this case, loop filter is also used as a name to exclude LMCS.

[0083] Deblocking filters remove block distortion generated at the boundaries between blocks. To determine whether to apply a deblocking filter, the selection can be based on samples included in several rows or columns within the block. When applying a deblocking filter to a block, different filters can be applied depending on the desired deblocking intensity.

[0084] To compensate for coding errors using sample-adaptive offsets, appropriate offset values ​​can be added to the sample values. Sample-adaptive offsets correct the offset of the deblocked image from the original image using sample cells. Methods include segmenting the samples included in the image into a predetermined number of regions, determining the regions to which the offset will be applied, and applying the offset to the determined regions; or applying the offset considering edge information about each sample.

[0085] The bilateral filter (BIF) can also correct the offset from the original image on a sample-by-sample basis for images that have been deblocked.

[0086] An adaptive loop filter (ALF) can perform filtering based on a comparison between the reconstructed image and the original image. Samples included in the image can be segmented into predetermined groups, the filter to be applied to each group can be determined, and differential filtering can be performed for each group. Information regarding whether to apply the ALF can be emitted by the decoding unit (CU) using a signal, and the form and coefficients of the adaptive loop filter to be applied to each block can be changed.

[0087] In Luminance Mapping with Chromatic Scaling (LMCS), luminance mapping (LM) means remapping luminance values ​​through a piecewise linear model, and chroma scaling (CS) means a technique for scaling the residual values ​​of the chroma components based on the average luminance values ​​of the predicted signal. Specifically, LMCS can be used as an HDR correction technique that reflects the characteristics of high dynamic range (HDR) images.

[0088] The reconstructed blocks or reconstructed image that have passed through filter unit 180 can be stored in reference image buffer 190. The reconstructed blocks that have passed through filter unit 180 can be part of a reference image. That is, the reference image is a reconstructed image composed of the reconstructed blocks that have passed through filter unit 180. The stored reference image can be used later in inter-frame prediction or motion compensation.

[0089] Figure 2 This is a block diagram illustrating the configuration of a decoding device according to an embodiment of the present invention.

[0090] Decoding device 200 can be a decoder, video decoding device, or image decoding device.

[0091] refer to Figure 2 The decoding device 200 may include an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra-frame prediction unit 240, a motion compensation unit 250, an adder 201, a switch 203, a filter unit 260, and a reference image buffer 270.

[0092] Decoding device 200 can receive bitstreams output from encoding device 100. Decoding device 200 can receive bitstreams stored on a computer-readable recording medium, or bitstreams transmitted via wired / wireless transmission media. Decoding device 200 can decode the bitstreams in intra-frame mode or inter-frame mode. Furthermore, decoding device 200 can generate and output reconstructed or decoded images generated through decoding.

[0093] When the prediction mode used for decoding is intra-frame mode, switch 203 can be switched to intra-frame mode. Alternatively, when the prediction mode used for decoding is inter-frame mode, switch 203 can be switched to inter-frame mode.

[0094] Decoding device 200 can obtain reconstructed residual blocks and generate prediction blocks by decoding the input bitstream. When the reconstructed residual blocks and prediction blocks are obtained, decoding device 200 can generate a reconstructed block that becomes the decoding target by adding the reconstructed residual blocks and prediction blocks together. The decoding target block can be referred to as the current block.

[0095] The entropy decoding unit 210 can generate symbols by entropy decoding the bitstream according to a probability distribution. The generated symbols may include symbols in the form of quantization levels. Here, the entropy decoding method can be the inverse process of the entropy encoding method described above.

[0096] The entropy decoding unit 210 can change the coefficients of a one-dimensional vector shape into coefficients of a two-dimensional block shape by using a transform coefficient scanning method to decode the transform coefficient level (quantization level).

[0097] The quantization level can be dequantized in inverse quantization unit 220 or inverse transformed in inverse transform unit 230. The quantization level can be the result of inverse quantization and / or inverse transform, and can be generated as a reconstructed residual block. Here, inverse quantization unit 220 can apply the quantization matrix to the quantization level. The inverse quantization unit 220 and inverse transform unit 230 applied to the decoding device can use the same techniques as the inverse quantization unit 160 and inverse transform unit 170 applied to the encoding device described above.

[0098] When using intra-frame mode, intra-frame prediction unit 240 can generate a prediction block by performing spatial prediction on the current block using sample values ​​from blocks already decoded around the target block. Intra-frame prediction unit 240 applied to the decoding device can employ the same techniques as intra-frame prediction unit 120 applied to the encoding device described above.

[0099] When using inter-frame mode, motion compensation unit 250 can generate a prediction block by performing motion compensation on the current block using motion vectors and a reference image stored in reference frame buffer 270. When the value of the motion vector is not an integer, motion compensation unit 250 can generate a prediction block by applying an interpolation filter to a portion of the reference image. To perform motion compensation, the motion compensation method for the prediction unit included in the corresponding compilation unit can be determined based on the compilation unit: skip mode, merge mode, AMVP mode, or current image reference mode, and motion compensation can be performed according to each mode. The motion compensation unit 250 applied to the decoding device can apply the same techniques as the motion compensation unit 122 applied to the encoding device described above.

[0100] Adder 201 generates a reconstructed block by adding the reconstructed residual block and the predicted block. Filter unit 260 can apply at least one of inverse LMCS, deblocking filter, sample adaptive offset, and adaptive loop filter to the reconstructed block or reconstructed image. Filter unit 260 applied to the decoding device can apply the same filtering techniques as those applied to filter unit 180 used in the encoding device described above.

[0101] Filter unit 260 can output a reconstructed image. The reconstructed blocks or the reconstructed image can be stored in reference image buffer 270 and used for inter-frame prediction. The reconstructed blocks that have passed through filter unit 260 can be part of the reference image. That is, the reference image can be a reconstructed image composed of reconstructed blocks that have passed through filter unit 260. The stored reference image can be used later in inter-frame prediction or motion compensation.

[0102] Figure 3 This is a schematic diagram illustrating a video encoding system to which the present invention can be applied.

[0103] The video encoding system according to an embodiment may include an encoding device 10 and a decoding device 20. The encoding device 10 may transmit encoded video and / or image information or data to the decoding device 20 in the form of a file or stream via a digital storage medium or network.

[0104] The encoding device 10 according to an embodiment may include a video source generation unit 11, an encoding unit 12, and a transmission unit 13. The decoding device 20 according to an embodiment may include a receiving unit 21, a decoding unit 22, and a rendering unit 23. The encoding unit 12 may be referred to as a video / image encoding unit, and the decoding unit 22 may be referred to as a video / image decoding unit. The transmission unit 13 may be included in the encoding unit 12. The receiving unit 21 may be included in the decoding unit 22. The rendering unit 23 may include a display unit, and the display unit may be configured as a separate device or an external component.

[0105] The video source generation unit 11 can acquire video / images through a process of capturing, synthesizing, or generating video / images. The video source generation unit 11 may include a video / image capturing device and / or a video / image generating device. The video / image capturing device may include, for example, one or more cameras, a video / image archive containing previously captured video / images, etc. The video / image generating device may include, for example, a computer, tablet computer, and smartphone, and can generate video / images (electronically). For example, virtual video / images can be generated by a computer, etc., in which case the video / image capture process can be replaced by a process of generating relevant data.

[0106] Encoding unit 12 can encode the input video / image. Encoding unit 12 can perform a series of processes for compression and encoding efficiency, such as prediction, transform, and quantization. Encoding unit 12 can output encoded data (encoded video / image information) in bitstream form. Detailed configuration of encoding unit 12 can also be described above. Figure 1 The encoding device 100 is configured in the same way.

[0107] The transmitting unit 13 can transmit encoded video / image information or data, output in bitstream form, to the receiving unit 21 of the decoding device 20 via a digital storage medium or network, either as a file or through streaming. The digital storage medium can include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. The transmitting unit 13 may include elements for generating media files according to a predetermined file format, and may also include elements for transmission via a broadcast / communication network. The receiving unit 21 can extract / receive the bitstream from the storage medium or network and transmit it to the decoding unit 22.

[0108] Decoding unit 22 can decode video / images by performing a series of processes (such as inverse quantization, inverse transform, and prediction) corresponding to the operations of encoding unit 12. Detailed configuration of decoding unit 22 can also be described above. Figure 2 The decoding device 200 is configured in the same way.

[0109] Rendering unit 23 can render decoded video / images. The rendered video / images can be displayed through the display unit.

[0110] This invention provides a method for improving prediction accuracy using brightness compensation. Brightness compensation is an inter-frame prediction method that models the brightness variation between the template of the current block and the template of the reference block to estimate the relationship between the current block and the reference block. The relationship between the current block and the reference block can be modeled as a linear equation as shown in Equation 1 below.

[0111] [Equation 1]

[0112] The scaling parameters α and offset β can be determined based on the current template (which is the template of the current block) and the template of the reference block. Here, p[x] can represent the reference sample value at the x-position within the reference block in the reference image, indicated by the motion vector (MV). Furthermore, p'[x] can be a predicted value generated through brightness compensation.

[0113] The reference block and the template of the reference block for inter-frame prediction based on a brightness compensation method using at least one template can be determined as follows.

[0114] Figure 4 This is a diagram illustrating the method for determining a reference block and a reference template in a brightness compensation method according to an embodiment of the present invention.

[0115] exist Figure 4 In this context, image 400 is the image at time t, and reference image 420 is the image at time tN. Here, t and N are arbitrary positive integer values, 0 ≤ tN < t. Figure 4In this context, for example, a reference image is an image that is earlier in time than the current image; however, for example, a reference image can also be an image that is later in time than the current image.

[0116] According to the brightness compensation method of the present invention, reference block 421 can be derived from motion vector MV0 410 in reference image 420. Additionally, reference template 422 can be derived based on samples adjacent to the reference block.

[0117] According to an embodiment, the shape of the reference template 422 may be a shape corresponding to the current template 402. Furthermore, the shape of the reference template may be determined from a plurality of shape candidates.

[0118] According to another embodiment, the number of reference templates 422 can be multiple. The shape of each of the multiple reference templates can be determined from multiple shape candidates.

[0119] Figure 5 This is a diagram illustrating a method for determining multiple reference blocks and reference templates in a brightness compensation method according to an embodiment of the present invention.

[0120] exist Figure 5 In this context, the current image 500 is the image at time t, and the L0 reference image 520 and L1 reference image 540 are images at times tM (tM > 0) and t+N (t+N > 0) (tM < t+N), respectively. Here, M and N are different (M < N) arbitrary positive integer values. Therefore, as... Figure 5 As shown, the time distance between L0 reference image 520 and the current image 500, and the time distance between L1 reference image 540 and the current image 500 are M and N, respectively, and they are different.

[0121] According to the brightness compensation method of the present invention, a first reference block 521 can be derived from the motion vector MV0 510 in the L0 reference image 520. At least a first reference template can be derived based on samples adjacent to the first reference block 521.

[0122] Additionally, the second reference block can be derived from the motion vector MV1530 in the L1 reference image 540. The second reference template 542 can be derived based on samples adjacent to the second reference block 541.

[0123] The shapes of the first reference template 522 and the second reference template 542 can be shapes corresponding to the current template 502. Furthermore, the shapes of the first reference template 522 and the second reference template 542 can be determined from a plurality of shape candidates.

[0124] According to one embodiment, the first reference template 522 and the second reference template 542 may have the same shape. On the other hand, according to another embodiment, the first reference template 522 and the second reference template 542 may have different shapes.

[0125] A template for a brightness compensation method using at least a template can be derived to have one or more shapes from a plurality of shape candidates. The plurality of template shape candidates used in the brightness compensation method are as follows.

[0126] Figure 6 This is a diagram illustrating a plurality of template shape candidates used in a brightness compensation method according to an embodiment of the present invention.

[0127] refer to Figure 6 For at least one reference block, a template can be one of a plurality of template shape candidates with different shapes.

[0128] Here, template shape candidates can include adjacent samples on the left and top sides of the block, such as... Figure 6 As shown in Figure 600, the template shape candidate including the adjacent samples on the left and top sides of the block can be referred to as the L-shaped template 600. Here, the L-shaped template 600 includes the adjacent samples on the left and top sides for brightness compensation, and can therefore be referred to as the local illumination compensation-top and left template (LIC-TL) template. The dimensions of the L-shaped template 600 can be represented by (w×L2) + (L1×h) + (L1×L2). Here, w and h represent the width and height of the block, and the values ​​of L1 and L2 can be any positive numbers.

[0129] Alternatively, template shape candidates may include adjacent samples to the left of the block, such as... Figure 6 As shown at point 610. The template shape candidate including the adjacent samples on the left side of the block can be referred to as the left template 610. Here, the left template 610 includes the adjacent samples on the left side for brightness compensation, and can therefore be referred to as the left local illumination compensation (LIC-L) template. The size of the left template 610 can be represented by L3×h. Here, h represents the height of the block, and the value of L3 can be any positive number.

[0130] Alternatively, template shape candidates may include adjacent samples on the top side of the block, such as... Figure 6As shown at position 620. The template shape candidate including the adjacent samples on the top side of the block can be referred to as the top-side template 620. Here, the top-side template 620 includes the adjacent samples on the top side for brightness compensation, and can therefore be referred to as the local illumination compensation-top (LIC-T) template. The size of the top-side template 620 can be represented by w × L4. Here, w represents the width of the block, and the value of L4 can be any positive number.

[0131] according to Figure 6 In this implementation, the distortion value of each in the matching block can be derived by using a current template that has one of the shapes of an L-shaped template 600, a left template 610, and a top template 620 and is adjacent to the current block, and a reference template that has the same shape as the current template and is adjacent to each in the matching block.

[0132] However, in addition to Figure 6 In addition to the examples shown, samples with various predefined shapes can be used around blocks in the encoder and decoder. The shape of the template is not limited to that described in this invention.

[0133] Alternatively, the template used to derive distortion from the predicted values ​​could be an L-shaped template based on information such as the size and location of the current block. Figure 6 Templates or templates with shapes implicitly determined from templates of various shapes and using samples around predefined blocks in the encoder and decoder.

[0134] According to an embodiment of the present invention, the brightness compensation method can be performed by using a fusion mode based on information fusion of multiple templates.

[0135] According to an embodiment of the present invention, the brightness compensation method can predict the current block by weighted sum of predicted values ​​generated based on at least one template.

[0136] [Equation 2]

[0137] Where n is a positive number greater than or equal to 2, and can represent the number of reference templates used in the fusion mode. Here, ω i Let represent the weights, and let i represent the index of the reference template. Weights are real numbers greater than or equal to 0, and their values ​​are ω0, ..., ωn. n-1 The sum is 1. According to the present invention, the method for calculating the weights is not limited to a specific method.

[0138] According to the implementation, weights can be calculated based on the distortion values ​​of the current template and the reference template obtained by performing luminance compensation. Here, the distortion values ​​can be calculated using methods such as SAD (Sum of Absolute Differences), SSE (Sum of Squared Errors), SATD (Sum of Absolute Transform Differences), or MR-SAD (Mean-Rated Sum of Absolute Differences). Alternatively, the weights can be determined as fixed weight values ​​committed in the encoder / decoder. Alternatively, the weights can be determined using the aspect ratio, width, and / or height of the current block. Optionally, the weights can be derived from surrounding information of the current block.

[0139] p'[x] i `x` can represent the predicted value generated by using brightness compensation with any template `i`, and `Final_p'[x]` can represent the final predicted value using the fusion mode. The offset in Equation 2 can represent the correction parameter. Here, the offset can have 0 or any positive / negative integer value.

[0140] According to another embodiment of the present invention, the brightness compensation method can fuse parameters generated based on at least one template, instead of predicted values ​​generated based on at least one template, and generate the final predicted value of the current block based on the fused parameter values. That is, according to the brightness compensation method of the present invention, the parameters α0,…,α can be selected. n-1 and β0,…,β n-1 The fusion parameter α is calculated from the minimum, maximum, or average value. fusion and β fusion The parameter α0,…,α n-1 and β0,…,β n-1 It can be derived from n templates (n is any positive number greater than or equal to 2) or from their weighted sum.

[0141] [Equation 3]

[0142] When passing through parameters α0, …, α n-1 and β0,… ,β n-1 The weighted summation is used to calculate the fusion parameter α. fusion and β fusion The weights at time t are real numbers greater than or equal to 0, and the sum of the weights is 1.

[0143] According to the implementation, weights can be calculated based on the distortion values ​​of the current template and the reference template obtained by performing luminance compensation. Here, the distortion values ​​can be calculated using methods such as SAD (Sum of Absolute Differences), SSE (Sum of Squared Errors), SATD (Sum of Absolute Transform Differences), or MR-SAD (Mean-Rated Sum of Absolute Differences). Alternatively, the weights can be determined as fixed weight values ​​committed in the encoder / decoder. Alternatively, the weights can be determined using the aspect ratio, width, and / or height of the current block. Optionally, the weights can be derived from surrounding information of the current block.

[0144] In addition, the final brightness compensation prediction value can be generated using the fusion parameters shown in Equation 4.

[0145] [Equation 4]

[0146] p[x] represents the reference sample value at position x within the reference block indicated by the motion vector (MV), and Final_p'[x] can represent the final prediction value using the fusion mode.

[0147] According to the implementation, when applying a brightness compensation method based on at least one template to the current block, flag information indicating whether the brightness compensation method based on at least one template is activated for the current block can be sent by signal. Alternatively, when applying a brightness compensation method based on a fusion mode to the current block, flag information indicating whether the brightness compensation method based on a fusion mode is activated for the current block can be sent by signal.

[0148] Flags can be encoded and / or decoded at higher levels (video parameter sets, sequence parameter sets, image parameter sets, image headers, stripe headers, etc.). Alternatively, flags can be encoded and / or decoded at lower levels (prediction blocks, decoding blocks, decoding tree blocks, etc.).

[0149] These flags can be transmitted independently using signals. Alternatively, these flags can be encoded and decoded depending on a flag indicating whether brightness compensation is activated. For example, these flags can be obtained only when the flag indicating whether brightness compensation is activated is acquired.

[0150] According to an embodiment of the present invention, information about the template used in the brightness compensation method can be further transmitted by signal.

[0151] According to the implementation, the information of the template used in the brightness compensation method may be a brightness compensation index indicating which template among brightness compensation templates such as LIC-TL, LIC-T, LIC-L, and fusion mode is used. The index indicating the template used in the brightness compensation method can be binary-coded as a fixed-length code (FLC) or a variable-length code (VLC).

[0152] According to another embodiment of the invention, it is possible to indicate whether a brightness compensation mode is enabled and / or information about the template used in the brightness compensation method without sending a signal. In this case, the encoder and / or decoder can search all multiple modes and use the mode with the minimum distortion value based on the distortion value between the current template and the reference template. Here, the distortion value can be calculated using methods such as SAD (Sum of Absolute Differences), SSE (Sum of Squared Errors), SATD (Sum of Absolute Transform Differences), and MR-SAD (Mean-Rated Sum of Absolute Differences).

[0153] Figure 7 An implementation of an inter-frame prediction method based on a brightness compensation method using at least one template is shown.

[0154] The image decoding device can determine at least one reference block of the current block from the reference image (S710).

[0155] The image decoding device can determine at least one brightness compensation parameter based on the current template of the current block and at least one reference template for at least one reference block (S720).

[0156] The image decoding device can generate at least one prediction block by modifying samples of at least one reference block based on at least one brightness compensation parameter (S730).

[0157] The image decoding device can generate a final prediction block for the current block based on at least one prediction block (S740).

[0158] Here, at least one reference template may have a shape determined from a plurality of template shape candidates.

[0159] Here, multiple template shape candidates may include: a first template shape, including a sample adjacent to the left side of the current block; a second template shape, including a sample adjacent to the top side of the current block; and a third template shape, including a sample adjacent to the left side of the current block and a sample adjacent to the top side of the current block.

[0160] Here, at least one reference block can be derived from the motion vector of the current block.

[0161] Here, at least one reference block may include a first reference block and a second reference block.

[0162] Here, at least one reference template may include a first reference template and a second reference template, the first reference template including samples adjacent to the first reference block, and the second reference template including samples adjacent to the second reference block.

[0163] Here, the first reference template and the second reference template can have the same shape.

[0164] Here, the first reference template and the second reference template may have different shapes.

[0165] Here, at least one brightness compensation parameter may include a first brightness compensation parameter indicating a first linear model between the current template and the first reference template, and a second brightness compensation parameter indicating a second linear model between the current template and the second reference template.

[0166] Here, the predicted block of the current block can be generated based on the first weight determined by the first reference template and the second weight determined by the second reference template.

[0167] Here, the first weight and the second weight can be determined based on the first distortion between the current template and the first reference template and the second distortion between the current template and the second reference template.

[0168] Here, the first weight can increase with the increase of the second distortion, and the second weight can increase with the increase of the first distortion.

[0169] Here, the predicted block for the current block can be generated by a weighted sum of samples from at least one reference block to which a first weight is applied and samples from at least one reference block to which a second weight is applied.

[0170] Here, the predicted block of the current block can be generated by modifying samples of at least one reference block based on the final brightness compensation parameter generated by the weighted sum of a first brightness compensation parameter with a first weight applied and a second brightness compensation parameter with a second weight applied.

[0171] At the same time, Figure 7 The steps described herein can be performed in an image encoding method. Furthermore, the bitstream can be encoded by including... Figure 7 The image encoding method described in the steps is used to generate the bitstream. The bitstream can be stored in a non-transitory computer-readable recording medium and can also be sent (or streamed).

[0172] Figure 8 An exemplary content streaming system applicable according to an embodiment of the present invention is shown.

[0173] like Figure 8 As shown, the content streaming system implementing the present invention may mainly include an encoding server, a streaming server, a network server, a media storage device, a user device, and a multimedia input device.

[0174] The encoding server compresses content received from multimedia input devices (such as smartphones, cameras, CCTV, etc.) into digital data to generate a bitstream and transmits it to the streaming media server. Alternatively, if the multimedia input device (e.g., smartphone, camera, CCTV, etc.) generates the bitstream directly, the encoding server can be omitted.

[0175] Bitstreams can be generated using the image encoding method and / or image encoding device applied in the embodiments of the present invention, and the streaming media server can temporarily store the bitstreams during the transmission or reception of the bitstreams.

[0176] A streaming server sends multimedia data to a user device via a web server based on a user request, and the web server can act as an intermediary to notify the user of any available services. When a user requests a desired service from the web server, the web server forwards it to the streaming server, and the streaming server can then send the multimedia data to the user. In this case, the content streaming system may include a separate control server, which in this scenario controls the commands / responses between devices within the content streaming system.

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

[0178] Examples of user devices may include mobile phones, smartphones, laptops, digital broadcasting terminals, personal digital assistants (PDAs), portable multimedia players (PMPs), navigation devices, tablet PCs, ultrabooks, wearable devices (e.g., smartwatches, smart glasses, HMDs), digital TVs, desktop computers, digital signage, etc.

[0179] In the above streaming system, each server can operate as a distributed server, in which case the data received from each server can be distributed and processed.

[0180] The above embodiments can be implemented in the same or corresponding manner in encoding and decoding devices. Additionally, at least one embodiment or a combination of at least one of the above embodiments can be used to encode / decode images.

[0181] The order in which the above embodiments are applied in the encoding and decoding devices may be different. Alternatively, the order in which the above embodiments are applied in the encoding and decoding devices may be the same.

[0182] The above embodiments can be performed for each of the luminance and chrominance signals. Alternatively, the above embodiments for luminance and chrominance signals can be performed identically.

[0183] In the above embodiments, the method is described based on a flowchart having a series of steps or units. However, the present invention is not limited to the order of the steps, but some steps may be performed simultaneously with other steps or in a different order. Furthermore, those skilled in the art should understand that the steps in the flowchart are not mutually exclusive, and other steps may be added to the flowchart or some steps may be deleted from the flowchart without affecting the scope of the present invention.

[0184] The implementation can be carried out in the form of program instructions executable by various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium may include individual program instructions, data files, data structures, etc., or combinations thereof. The program instructions recorded in the computer-readable recording medium may be specifically designed and constructed for this invention, or may be well known to those skilled in the art of computer software.

[0185] The bitstream generated by the encoding method according to the above embodiments can be stored in a non-transitory computer-readable recording medium. Furthermore, the bitstream stored in the non-transitory computer-readable recording medium can be decoded by the decoding method according to the above embodiments.

[0186] Examples of computer-readable recording media include magnetic recording media such as hard disks, floppy disks, and magnetic tapes; optical data storage media such as CD-ROMs or DVD-ROMs; magneto-optical media such as floppy disks; and hardware devices such as read-only memory (ROM), random access memory (RAM), flash memory, etc., which are specifically configured to store and implement program instructions. Examples of program instructions include not only machine language code formatted by a compiler, but also high-level language code that can be implemented by a computer using an interpreter. The hardware device can be configured to operate by one or more software modules, and vice versa, to perform the processing according to the invention.

[0187] Although the invention has been described with reference to specific items such as detailed elements, as well as limited embodiments and drawings, these items are merely provided to aid in a more complete understanding of the invention, and the invention is not limited to the embodiments described above. Those skilled in the art will understand that various modifications and changes can be made from the above description.

[0188] Therefore, the spirit of the present invention should not be limited to the above-described embodiments, and the entire scope of the appended claims and their equivalents shall fall within the scope and spirit of the present invention.

[0189] Industrial applicability

[0190] This invention can be used in devices for encoding / decoding images and in recording media for storing bit streams.

Claims

1. An image decoding method, comprising: Identify at least one reference block from the reference image for the current block; At least one brightness compensation parameter is determined based on the current template of the current block and at least one reference template for the at least one reference block; At least one prediction block is generated by modifying the samples of the at least one reference block based on the at least one brightness compensation parameter; and The final prediction block for the current block is generated based on the at least one prediction block. The at least one reference template has a shape determined from a plurality of template shape candidates.

2. The image decoding method according to claim 1, wherein, The plurality of template shape candidates include a first template shape, a second template shape, and a third template shape. The first template shape includes a sample adjacent to the left side of the current block, the second template shape includes a sample adjacent to the top side of the current block, and the third template shape includes a sample adjacent to the left side of the current block and a sample adjacent to the top side of the current block.

3. The image decoding method according to claim 1, wherein, The at least one reference block is derived from the motion vector of the current block.

4. The image decoding method according to claim 1, wherein, The at least one reference block includes a first reference block and a second reference block.

5. The image decoding method according to claim 4, wherein, The at least one reference template includes a first reference template and a second reference template, wherein the first reference template includes samples adjacent to the first reference block, and the second reference template includes samples adjacent to the second reference block.

6. The image decoding method according to claim 5, wherein, The first reference template and the second reference template have the same shape.

7. The image decoding method according to claim 5, wherein, The first reference template and the second reference template have different shapes.

8. The image decoding method according to claim 5, wherein, The at least one brightness compensation parameter includes a first brightness compensation parameter indicating a first linear model between the current template and the first reference template, and a second brightness compensation parameter indicating a second linear model between the current template and the second reference template.

9. The image decoding method according to claim 8, wherein, The prediction block of the current block is generated based on a first weight determined based on the first reference template and a second weight determined based on the second reference template.

10. The image decoding method according to claim 9, wherein, The first weight and the second weight are determined based on the first distortion between the current template and the first reference template and the second distortion between the current template and the second reference template.

11. The image decoding method according to claim 10, in, The first weight increases as the second distortion increases, and The second weight increases as the first distortion increases.

12. The image decoding method according to claim 9, wherein, The predicted block of the current block is generated by weighted summation of samples from at least one reference block with the first weight applied and samples from at least one reference block with the second weight applied.

13. The image decoding method according to claim 9, wherein, The predicted block of the current block is generated by modifying the samples of the at least one reference block based on the final brightness compensation parameter, which is generated by weighted summing of the first brightness compensation parameter with the first weight applied and the second brightness compensation parameter with the second weight applied.

14. An image coding method, comprising: Determine the first and second reference blocks of the current block from the current image; Determine the first brightness compensation parameters of the current template of the current block and the first reference template of the first reference block, and the second brightness compensation parameters of the current template and the second reference template of the second reference block; The first prediction block derived from the first reference block is modified according to the first brightness compensation parameter, and the second prediction block derived from the second reference block is modified according to the second brightness compensation parameter; and The final prediction block of the current block is determined from the modified first prediction block and the modified second prediction block.

15. A non-transitory computer-readable recording medium for storing a bitstream generated by an image encoding method, the image encoding method comprising: Determine the first and second reference blocks of the current block from the current image; Determine the first brightness compensation parameters of the current template of the current block and the first reference template of the first reference block, and the second brightness compensation parameters of the current template and the second reference template of the second reference block; The first prediction block derived from the first reference block is modified according to the first brightness compensation parameter, and the second prediction block derived from the second reference block is modified according to the second brightness compensation parameter; and The final prediction block of the current block is determined from the modified first prediction block and the modified second prediction block.

16. A method for transmitting a bitstream generated by an image encoding method, the method comprising: The image is encoded based on the image encoding method described above; and Send a bitstream including the encoded image. The image encoding method includes: Determine the first and second reference blocks of the current block from the current image; Determine the first brightness compensation parameters of the current template of the current block and the first reference template of the first reference block, and the second brightness compensation parameters of the current template and the second reference template of the second reference block; The first prediction block derived from the first reference block is modified according to the first brightness compensation parameter, and the second prediction block derived from the second reference block is modified according to the second brightness compensation parameter; and The final prediction block of the current block is determined from the modified first prediction block and the modified second prediction block.