Video decoding method using residual information in video coding system and apparatus therefor

文档序号:108592 发布日期:2021-10-15 浏览:25次 中文

阅读说明:本技术 在视频编译系统中使用残差信息的视频解码方法及其设备 (Video decoding method using residual information in video coding system and apparatus therefor ) 是由 柳先美 崔情娥 金昇焕 于 2020-02-19 设计创作,主要内容包括:根据本文档,一种由解码设备执行的视频解码方法包括以下步骤:接收当前块的残差信息;推导当前块的当前子块中的当前残差系数的符号标志的上下文模型;基于上下文模型对符号标志进行解码;基于符号标志来推导当前残差系数;基于当前残差系数来推导残差样本;以及基于残差样本来生成重构图片,其中,符号标志的上下文模型是基于在当前子块中的当前残差系数之前解码的残差系数的符号标志而推导的。(According to this document, a video decoding method performed by a decoding apparatus includes the steps of: receiving residual error information of a current block; deriving a context model of a sign indication of a current residual coefficient in a current sub-block of a current block; decoding the symbol flags based on the context model; deriving current residual coefficients based on the sign flags; deriving residual samples based on the current residual coefficients; and generating a reconstructed picture based on the residual samples, wherein the context model of the sign flag is derived based on a sign flag of a residual coefficient decoded before a current residual coefficient in the current sub-block.)

1. An image decoding method performed by a decoding apparatus, comprising:

receiving residual information for a current block;

deriving a context model for a sign flag of a current residual coefficient in a current sub-block of the current block;

decoding the symbol flags based on the context model;

deriving the current residual coefficients based on the sign flag;

deriving residual samples based on the current residual coefficients; and

generating a reconstructed picture based on the residual samples,

wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient decoded before the current residual coefficient in the current sub-block.

2. The image decoding method according to claim 1,

wherein the context model for the sign flag of the current residual coefficient is derived as context model 0 when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 0, an

Wherein the context model for the sign flag of the current residual coefficient is derived as context model 1 when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 1.

3. The image decoding method according to claim 1, further comprising: determining whether to decode the sign flag based on the context model by comparing a particular value to a number of non-zero residual coefficients in the current sub-block.

4. The image decoding method according to claim 3,

wherein the sign flag is bypass decoded when the number of non-zero residual coefficients is less than the certain value, an

Wherein the sign flag is decoded based on the context model when the number of non-zero residual coefficients is greater than or equal to the certain value.

5. The image decoding method of claim 3, wherein the specific value is derived based on a size of the current block.

6. The image decoding method according to claim 5,

wherein the specific value is derived to be 5 when the size of the current block is 8x8 size, an

Wherein the specific value is derived to be 4 when the size of the current block is 4x4 size.

7. The image decoding method of claim 3, wherein the specific value is derived based on a size of the current block and a position of the current sub-block in the current block.

8. The image decoding method according to claim 7,

wherein the specific value is derived to be 5 when the size of the current block is 8x8 size and the current sub-block is the lower-right sub-block of the current block, an

Wherein the specific value is derived to be 4 when the size of the current block is 8x8 size and the current sub-block is the upper left block of the current block.

9. The image decoding method of claim 3, wherein the specific value is derived based on a size of the current block, a position of the sub-block in the current block, and a prediction mode of the current block.

10. The image decoding method according to claim 9,

wherein the specific value is derived to be 5 when the size of the current block is 8x8 size, the current sub-block is a lower-right sub-block of the current block, and the prediction mode of the current block is an intra prediction mode, and

wherein the specific value is derived to be 0 when the size of the current block is 8x8 size, the current sub-block is the top-left sub-block of the current block, and the prediction mode of the current block is an intra prediction mode.

11. The image decoding method of claim 1, wherein the context model of the sign flag is derived as one of a plurality of context models based on a sign flag of a plurality of residual coefficients decoded before the current residual coefficient in the current sub-block.

12. An image encoding method performed by an encoding apparatus, comprising:

deriving a current residual coefficient in a current sub-block of the current block;

deriving a context model for a sign flag of the current residual coefficient;

encoding the symbol marker based on the context model; and

generating a bit stream comprising the symbol flags,

wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient encoded before the current residual coefficient in the current sub-block.

13. The image encoding method according to claim 12,

wherein the context model for the sign flag of the current residual coefficient is derived as context model 0 when the value of the sign flag of the residual coefficient coded before the current residual coefficient is 0, an

Wherein the context model for the sign flag of the current residual coefficient is derived as context model 1 when the value of the sign flag of the residual coefficient encoded before the current residual coefficient is 1.

14. The image encoding method of claim 12, further comprising: determining whether to encode the sign flag based on the context model by comparing a particular value to a number of non-zero residual coefficients in the current sub-block.

15. The image encoding method according to claim 14,

wherein the sign flag is bypass coded when the number of non-zero residual coefficients is less than the certain value, an

Wherein the sign flag is encoded based on the context model when the number of non-zero residual coefficients is greater than or equal to the particular value.

16. A non-transitory computer readable storage medium storing a bitstream including image information that causes a decoding apparatus to perform the steps of:

obtaining residual information for a current block;

deriving a context model for a sign flag of a current residual coefficient in a current sub-block of the current block;

decoding the symbol flags based on the context model;

deriving the current residual coefficients based on the sign flag;

deriving residual samples based on the current residual coefficients; and

generating a reconstructed picture based on the residual samples,

wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient decoded before the current residual coefficient in the current sub-block.

Technical Field

The present disclosure relates to an image coding technique, and more particularly, to an image decoding method in which a context model of a sign flag indicating a sign (sign) of a residual coefficient is derived in an image coding system and the sign flag is coded based on the derived context model, and an apparatus thereof.

Background

Recently, demands for high-resolution, high-quality images such as HD (high definition) images and UHD (ultra high definition) images are increasing in various fields. Since the image data has high resolution and high quality, the amount of information or bits to be transmitted increases relative to conventional image data. Therefore, when image data is transmitted using a medium such as a conventional wired/wireless broadband line or stored using an existing storage medium, transmission costs and storage costs thereof increase.

Accordingly, there is a need for efficient image compression techniques for efficiently transmitting, storing, and reproducing information for high-resolution, high-quality images.

Disclosure of Invention

The present disclosure provides a method and apparatus for improving image compilation efficiency.

The present disclosure also provides a method and apparatus for improving efficiency of residual coding.

The present disclosure also provides a method and apparatus for performing coding by deriving a context model indicating a sign of a residual coefficient based on a sign of a previous residual coefficient coded before the residual coefficient when residual information is coded.

According to an embodiment of the present disclosure, there is provided an image decoding method performed by a decoding apparatus. The method comprises the following steps: receiving residual error information of a current block; deriving a context model for a sign indicator of current residual coefficients in a current sub-block of a current block; decoding the symbol flags based on a context model; deriving current residual coefficients based on the sign flags; deriving residual samples based on the current residual coefficients; and generating a reconstructed picture based on the residual samples, wherein a context model for a sign flag is derived based on a sign flag of a residual coefficient decoded before a current residual coefficient in the current sub-block.

According to another embodiment of the present disclosure, there is provided a decoding apparatus for performing image decoding. The decoding apparatus includes: an entropy decoder for receiving residual information of a current block, deriving a context model for a sign flag of a current residual coefficient in a current sub-block of the current block, decoding the sign flag based on the context model, and deriving the current residual coefficient based on the sign flag; a transformer for deriving residual samples based on current residual coefficients; and an adder for generating a reconstructed picture based on the residual samples, wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient decoded before a current residual coefficient in the current sub-block.

According to another embodiment of the present disclosure, there is provided an image encoding method performed by an encoding apparatus. The method comprises the following steps: deriving a current residual coefficient in a current sub-block of the current block; deriving a context model for a sign flag of a current residual coefficient; encoding the symbolic flag based on a context model; and generating a bitstream including a sign flag, wherein a context model for the sign flag is derived based on the sign flag of a residual coefficient coded before a current residual coefficient in a current sub-block.

According to another embodiment of the present disclosure, there is provided a video encoding apparatus. The encoding device includes: a transformer for deriving current residual coefficients in a current sub-block of the current block; and an encoder for deriving a context model for a sign flag of the current residual coefficient, encoding the sign flag based on the context model, and generating a bitstream including the sign flag, wherein the context model for the sign flag is derived based on the sign flag of a residual coefficient encoded before the current residual coefficient in the current sub-block.

Advantageous effects

According to this document, the overall image/video compression efficiency can be improved.

According to this document, the efficiency of residual coding can be improved.

According to the present disclosure, a sign flag indicating a sign of a residual coefficient can be coded based on a context model, thereby saving a bit amount of the sign flag assigned to the residual coefficient and improving overall residual coding efficiency.

According to the present disclosure, a context model for indicating a sign flag of a sign of a residual coefficient is derived based on a sign flag of a residual coefficient coded before the residual coefficient, and thus the sign flag is coded by considering correlation between neighboring residual coefficients, thereby saving the amount of bits assigned to the sign flag and improving overall residual coding efficiency.

Drawings

Fig. 1 schematically illustrates an example of a video/image compilation apparatus to which an embodiment of this document can be applied.

Fig. 2 is a schematic diagram illustrating a configuration of a video/image encoding device to which an embodiment of this document can be applied.

Fig. 3 is a schematic diagram illustrating a configuration of a video/image decoding apparatus to which an embodiment of this document can be applied.

Fig. 4 exemplarily shows context-adaptive binary arithmetic coding (CABAC) for encoding a syntax element.

Fig. 5 is a diagram showing exemplary transform coefficients within a 4x4 block.

Fig. 6 illustrates an example of performing encoding by determining a method of coding a symbol flag based on whether a transform is applied to a current block.

Fig. 7 illustrates an example of performing decoding by determining a method of coding a symbol flag based on whether a transform is applied to a current block.

Fig. 8 briefly illustrates an image encoding method performed by the encoding apparatus according to the present disclosure.

Fig. 9 briefly illustrates an encoding apparatus for performing an image encoding method according to the present disclosure.

Fig. 10 briefly illustrates an image decoding method performed by the decoding apparatus according to the present disclosure.

Fig. 11 briefly illustrates a decoding apparatus for performing an image decoding method according to the present disclosure.

Fig. 12 illustrates a structure diagram of a content streaming system to which the present disclosure is applied.

Detailed Description

The present disclosure may be modified in various forms and specific embodiments thereof will be described and illustrated in the accompanying drawings. However, the embodiments are not intended to limit the present disclosure. The terminology used in the following description is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. Expressions in the singular include expressions in the plural as long as they are clearly understood in a different manner. Terms such as "including" and "having" are intended to indicate the presence of features, numbers, steps, operations, elements, components, or combinations thereof used in the following description, and thus should be understood as not excluding the possibility of one or more different features, numbers, steps, operations, elements, components, or combinations thereof being present or added.

Furthermore, elements in the drawings described in the present disclosure are separately drawn for convenience in explaining different specific functions, and it is not meant that the elements are embodied by separate hardware or separate software. For example, two or more of the elements may be combined to form a single element, or one element may be divided into a plurality of elements. Embodiments in which elements are combined and/or divided are within the present disclosure without departing from the concepts of the present disclosure.

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

Fig. 1 schematically illustrates an example of a video/image compilation apparatus to which embodiments of the present disclosure are applicable.

Referring to fig. 1, a video/image compilation system may include a first device (source device) and a second device (sink device). The source device may transmit the encoded video/image information or data to the sink device in the form of a file or stream via a digital storage medium or a network.

The source device may include a video source, an encoding apparatus, and a transmitter. The receiving apparatus may include a receiver, a decoding device, and a renderer. The encoding device may be referred to as a video/image encoding device, and the decoding device may be referred to as a video/image decoding device. The transmitter may be comprised in an encoding device. The receiver may be comprised in a decoding device. The renderer may include a display, and the display may be configured as a separate device or an external component.

The video source may acquire the video/image by capturing, synthesizing, or generating the video/image. The video source may include a video/image capture device and/or a video/image generation device. The video/image capture device may include, for example, one or more cameras, video/image archives including previously captured video/images, and the like. The video/image generation means may comprise, for example, a computer, a tablet computer and a smartphone, and may generate the video/image (electronically). For example, the virtual video/image may be generated by a computer or the like. In this case, the video/image capturing process may be replaced by a process of generating the relevant data.

The encoding apparatus may encode the input video/image. An encoding apparatus may perform a series of processes such as prediction, transformation, and quantization to achieve compression and coding efficiency. The encoded data (encoded video/image information) may be output in the form of a bitstream.

The transmitter may transmit the encoded image/image information or data, which is output in the form of a bitstream, to the receiver of the receiving apparatus in the form of a file or a stream through a digital storage medium or a network. The digital storage medium may include various storage media such as USB, SD, CD, DVD, blu-ray, HDD, SSD, and the like. The transmitter may include elements for generating a media file through a predetermined file format, and may include elements for transmitting through a broadcast/communication network. The receiver may receive/extract a bitstream and transmit the received bitstream to the decoding apparatus.

The decoding apparatus may decode the video/image by performing a series of processes such as dequantization, inverse transformation, and prediction corresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The rendered video/image may be displayed by a display.

This document relates to video/image compilation. For example, the methods/embodiments disclosed in this document may be applied to methods disclosed in the multifunctional Video coding (VVC), EVC (basic Video coding) standard, AOMedia Video 1(AV1) standard, 2 nd generation audio Video coding standard (AVs2), or next generation Video/image coding standard (e.g., h.267, h.268, or the like).

This document presents various embodiments of video/image compilation, and unless otherwise mentioned, embodiments may be performed in combination with each other.

In this document, a video may refer to a series of images over a period of time. A picture generally refers to a unit representing one image in a specific time region, and a slice (slice)/tile (tile) is a unit constituting a part of a picture in coding. A slice/tile may include one or more Compiled Tree Units (CTUs). A picture may include one or more slices/tiles. A picture may include one or more groups of tiles. A tile group may include one or more tiles. Tiles (brick) may represent rectangular areas of rows of CTUs within a tile in a picture. A tile may be partitioned into a plurality of tiles, each tile including one or more rows of CTUs within the tile. Tiles that are not partitioned into multiple tiles may also be referred to as tiles. The tile scan is a particular sequential ordering of CTUs in which pictures in which CTUs are partitioned in a CTU raster scan of the tiles are ordered consecutively, the tiles within a tile are arranged consecutively in the raster scan of the tiles of the tile, and the tiles in the picture are ordered consecutively in the raster scan of the tiles of the picture. A tile is a rectangular region of CTUs within a particular tile column and a particular tile row in a picture. A tile column is a rectangular region of CTUs with a height equal to the height of the picture and a width specified by syntax elements in the picture parameter set. A picture row is a rectangular region of CTUs whose height is specified by a syntax element in the picture parameter set and whose width is equal to the picture width. Tile scanning refers to a particular sequential ordering of CTUs that partitions a picture in which CTUs are sequentially ordered in a CTU raster scan of the tiles, while tiles in the picture are sequentially ordered in a raster scan of the tiles of the picture. A slice includes an integer number of tiles of a picture that can be uniquely contained in a single NAL unit. A slice may include a plurality of complete tiles, or a contiguous sequence of complete patches of only one tile. Tile groups and slices are used interchangeably in this document. For example, in this document, a tile group/tile group header may be referred to as a slice/slice header.

A pixel or pel may represent the smallest unit that constitutes a picture (or image). In addition, "sample" may be used as a term corresponding to a pixel. The samples may generally represent pixels or pixel values and may represent only pixels/pixel values of a luminance component or only pixels/pixel values of a chrominance component.

The cell may represent a basic unit of image processing. The unit may include at least one of a specific region of the picture and information related to the region. One unit may include one luminance block and two chrominance (e.g., cb, cr) blocks. In some cases, a unit may be used interchangeably with terms such as block or region. In general, an mxn block may include M columns and N rows of samples (or sample arrays) or sets (or arrays) of transform coefficients.

In this document, the terms "/" and "," should be interpreted as indicating "and/or". For example, the expression "a/B" may mean "a and/or B". Further, "A, B" may represent "a and/or B". Further, "a/B/C" may mean "A, B and/or at least one of C". In addition, "a/B/C" may mean "A, B and/or at least one of C".

Furthermore, in this document, the term "or" should be interpreted as indicating "and/or". For example, the expression "a or B" may include 1) only a, 2) only B, and/or 3) both a and B. In other words, the term "or" in this document should be interpreted as indicating "additionally or alternatively. "

Fig. 2 is a schematic diagram illustrating a configuration of a video/image encoding device to which an embodiment of this document can be applied. Hereinafter, the video encoding apparatus may include an image encoding apparatus.

Referring to fig. 2, the encoding apparatus 200 includes an image partition 210, a predictor 220, a residual processor 230 and an entropy encoder 240, an adder 250, a filter 260, and a memory 270. The predictor 220 may include an inter predictor 221 and an intra predictor 222. The residual processor 230 may include a transformer 232, a quantizer 233, a dequantizer 234, and an inverse transformer 235. The residue processor 230 may further include a subtractor 231. The adder 250 may be referred to as a reconstructor or reconstruction block generator. According to an embodiment, the image partitioner 210, the predictor 220, the residue processor 230, the entropy coder 240, the adder 250, and the filter 260 may be comprised of at least one hardware component (e.g., an encoder chipset or processor). In addition, the memory 270 may include a Decoded Picture Buffer (DPB) or may be formed of a digital storage medium. The hardware components may also include memory 270 as an internal/external component.

The image partitioner 210 may partition an input image (or picture or frame) input to the encoding apparatus 200 into one or more processors. For example, a processor may be referred to as a Coding Unit (CU). In this case, the coding unit may be recursively split from a Coding Tree Unit (CTU) or a Largest Coding Unit (LCU) according to a quadtree binary tree ternary tree (QTBTTT) structure. For example, one coding unit may be partitioned into a plurality of coding units deeper in depth based on a quadtree structure, a binary tree structure, and/or a ternary structure. In this case, for example, a quadtree structure may be applied first, and then a binary tree structure and/or a ternary structure may be applied. Alternatively, a binary tree structure may be applied first. The compilation process according to the present document may be performed based on the final compilation unit that is no longer partitioned. In this case, the maximum coding unit may be used as the final coding unit based on coding efficiency according to image characteristics, or if necessary, the coding unit may be recursively partitioned into deeper coding units and a coding unit having an optimal size may be used as the final coding unit. Here, the coding process may include processes of prediction, transformation, and reconstruction, which will be described later. As another example, the processor may also include a Prediction Unit (PU) or a Transform Unit (TU). In this case, the prediction unit and the transform unit may be separated or partitioned from the above-described 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 residual signals from transform coefficients.

In some cases, a unit may be used interchangeably with terms such as block or region. In general, an mxn block may represent a set of samples or transform coefficients composed of M columns and N rows. The samples may generally represent pixels or pixel values, may represent only pixels/pixel values of a luminance component, or may represent only pixels/pixel values of a chrominance component. A sample may be used as a term corresponding to a picture (or image) of pixels or picture elements.

In the encoding apparatus 200, a prediction signal (prediction block, prediction sample array) output from the inter predictor 221 or the intra predictor 222 is subtracted from an input image 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 transformer 232. In this case, as shown in the figure, a unit for subtracting a prediction signal (prediction block, prediction sample array) from an input image signal (original block, original sample array) in the encoder 200 may be referred to as a subtractor 231. The predictor may perform prediction on a block to be processed (hereinafter, referred to as a current block) and generate a prediction block including prediction samples of the current block. The predictor may determine whether to apply intra prediction or inter prediction based on the current block or CU. As described later in the description of each prediction mode, the predictor may generate various information related to prediction, such as prediction mode information, and transmit the generated information to the entropy encoder 240. Information on the prediction may be encoded in the entropy encoder 240 and output in the form of a bitstream.

The intra predictor 222 may predict the current block by referring to samples in the current picture. Depending on the prediction mode, the referenced samples may be located near the current block or may be located far away from the current block. In intra prediction, the prediction modes may include a plurality of non-directional modes and a plurality of directional modes. The non-directional mode may include, for example, a DC mode and a planar mode. Depending on the degree of detail of the prediction direction, the directional modes may include, for example, 33 directional prediction modes or 65 directional prediction modes. However, this is merely an example, and more or fewer directional prediction modes may be used depending on the setting. The intra predictor 222 may determine a prediction mode applied to the current block by using prediction modes applied to neighboring blocks.

The inter predictor 221 may derive a prediction block for the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. Here, in order to reduce the amount of motion information transmitted in the 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 also include inter prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter prediction, the neighboring blocks may include spatial neighboring blocks existing in a current picture and temporal neighboring blocks existing in a reference picture. The reference picture comprising the reference block and the reference picture comprising the temporal neighboring block may be the same or different. The temporal neighboring blocks may be referred to as collocated reference blocks, co-located cus (colcu), etc., and the reference pictures including the temporal neighboring blocks may be referred to as collocated pictures (colPic). For example, the inter predictor 221 may configure a motion information candidate list based on neighboring blocks and generate information indicating which candidate is used to derive a motion vector and/or a reference picture index of the current block. Inter prediction may be performed based on various prediction modes. For example, in the case of the skip mode and the merge mode, the inter predictor 221 may use motion information of an adjacent block as motion information of the current block. In the skip mode, unlike the merge mode, a residual signal may not be transmitted. In case of a Motion Vector Prediction (MVP) mode, motion vectors of neighboring blocks may be used as a motion vector predictor, and a motion vector of a current block may be indicated by signaling a motion vector difference.

The predictor 220 may generate a prediction signal based on various prediction methods described below. For example, the predictor may not only apply intra prediction or inter prediction to predict one block, but also apply both intra prediction and inter prediction at the same time. This may be referred to as inter-frame intra-combined prediction (CIIP). In addition, the predictor may predict the block based on an Intra Block Copy (IBC) prediction mode or a palette mode. The IBC prediction mode or palette mode may be used for content image/video coding, e.g., screen content coding (step, SCC), of games and the like. IBC basically performs prediction in the current picture, but can be performed similarly to inter prediction, since the reference block is derived in the current picture. That is, IBC may use at least one of the inter prediction techniques described in this document. The palette mode may be considered as an example of intra coding or intra prediction. When the palette mode is applied, the sample values within the picture may be signaled based on information about the palette table and palette indices.

The prediction signal generated by the predictor (including the inter predictor 221 and/or the intra predictor 222) may be used to generate a reconstructed signal or to generate a residual signal. The transformer 232 may generate a transform coefficient 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-lo eve transform (KLT), a graph-based transform (GBT), or a conditional non-linear transform (CNT). Here, GBT denotes a transform obtained from a graph when relationship information between pixels is represented by the graph. CNT refers to a transform generated based on a prediction signal generated using all previously reconstructed pixels. In addition, the transform process may be applied to square pixel blocks having the same size, or may be applied to blocks having a variable size other than a square.

The quantizer 233 may quantize the transform coefficients and send them to the entropy encoder 240, and the entropy encoder 240 may encode a quantized signal (information on the quantized transform coefficients) and output a bitstream. Information on quantized transform coefficients may be referred to as residual information. The quantizer 233 may rearrange the block-type quantized transform coefficients into a one-dimensional vector form based on the coefficient scan order, and generate information on the quantized transform coefficients based on the quantized transform coefficients in the one-dimensional vector form. Information about the transform coefficients may be generated. The entropy encoder 240 may perform various encoding methods such as, for example, exponential Golomb (Golomb), Context Adaptive Variable Length Coding (CAVLC), Context Adaptive Binary Arithmetic Coding (CABAC), and the like. The entropy encoder 240 may encode information (e.g., values of syntax elements, etc.) required for video/image reconstruction in addition to the quantized transform coefficients, together or separately. The encoding information (e.g., encoded video/image information) may be transmitted or stored in units of NAL (network abstraction layer) in the form of a bitstream. The video/image information may also include information on various parameter sets such as an Adaptive Parameter Set (APS), a Picture Parameter Set (PPS), a sequence parameter set (step, SPS), or a Video Parameter Set (VPS). In addition, the video/image information may also include general constraint information. In this document, information and/or syntax elements transmitted/signaled from an encoding device to a decoding device may be included in video/picture information. The video/image information may be encoded by the above-described encoding process and included in the bitstream. The bitstream may be transmitted through a network or may be stored in a digital storage medium. The network may include a broadcast network and/or a communication network, and the digital storage medium may include various storage media such as USB, SD, CD, DVD, blu-ray, HDD, SSD, and the like. A transmitter (not shown) transmitting a signal output from the entropy encoder 240 and/or a storage unit (not shown) storing the signal may be included as an internal/external element of the encoding apparatus 200, and alternatively, the transmitter may be included in the entropy encoder 240.

The quantized transform coefficients output from the quantizer 233 may be used to generate a prediction signal. For example, a residual signal (residual block or residual sample) may be reconstructed by applying dequantization and inverse transform to the quantized transform coefficients using a dequantizer 234 and an inverse transformer 235. The adder 250 adds the reconstructed residual signal to the prediction signal output from the inter predictor 221 or the intra predictor 222 to generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array). If the block to be processed has no residual (such as the case where the skip mode is applied), the prediction block may be used as a reconstructed block. The adder 250 may be referred to as a reconstructor or reconstruction block generator. The generated reconstructed signal may be used for intra prediction of a next block to be processed in a current picture, and may be used for inter prediction of a next picture through filtering as described below.

Furthermore, during picture encoding and/or reconstruction, luma mapping with chroma scaling (LMCS) may be applied.

Filter 260 may improve subjective/objective image quality by applying filtering to the reconstructed signal. For example, the filter 260 may generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture and store the modified reconstructed picture in the memory 270 (specifically, the DPB of the memory 270). The various filtering methods may include, for example, deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, and so on. The filter 260 may generate various information related to filtering and transmit the generated information to the entropy encoder 240, as described later in the description of various filtering methods. The information related to the filtering may be encoded by the entropy encoder 240 and output in the form of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may be used as a reference picture in the inter predictor 221. When inter prediction is applied by the encoding apparatus, prediction mismatch between the encoding apparatus 200 and the decoding apparatus can be avoided and coding efficiency can be improved.

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

Fig. 3 is a schematic diagram illustrating a configuration of a video/image decoding apparatus to which an embodiment of this document can be applied.

Referring to fig. 3, the decoding apparatus 300 may include an entropy decoder 310, a residual processor 320, a predictor 330, an adder 340, a filter 350, and a memory 360. The predictor 330 may include an inter predictor 332 and an intra predictor 331. The residual processor 320 may include a dequantizer 321 and an inverse transformer 322. According to an embodiment, the entropy decoder 310, the residual processor 320, the predictor 330, the adder 340, and the filter 350 may be formed of hardware components (e.g., a decoder chipset or processor). In addition, the memory 360 may include a Decoded Picture Buffer (DPB), or may be composed of a digital storage medium. The hardware components may also include memory 360 as internal/external components.

When a bitstream including video/image information is input, the decoding apparatus 300 may reconstruct an image corresponding to a process of processing the video/image information in the encoding apparatus of fig. 2. For example, the decoding apparatus 300 may derive units/blocks based on block partition related information obtained from a bitstream. The decoding apparatus 300 may perform decoding using a processor applied in the encoding apparatus. Thus, the decoded processor may be, for example, a coding unit, and the coding unit may be partitioned from the coding tree unit or the maximum coding unit according to a quadtree structure, a binary tree structure, and/or a ternary tree structure. One or more transformation units may be derived from the compilation unit. The reconstructed image signal decoded and output by the decoding apparatus 300 may be reproduced by a reproducing apparatus.

The decoding apparatus 300 may receive a signal output from the encoding apparatus of fig. 2 in the form of a bitstream and may decode the received signal through the entropy decoder 310. For example, the entropy decoder 310 may parse the bitstream to derive information (e.g., video/image information) needed for image reconstruction (or picture reconstruction). The video/image information may also include information on various parameter sets such as an Adaptive Parameter Set (APS), a Picture Parameter Set (PPS), a sequence parameter set (step, SPS), or a Video Parameter Set (VPS). In addition, the video/image information may also include general constraint information. The decoding device may also decode the picture based on the information about the parameter set and/or the general constraint information. The signaled/received information and/or syntax elements described later in this document can be decoded by a decoding process and retrieved from the bitstream. For example, the entropy decoder 310 decodes information in a bitstream based on a coding method such as exponential golomb coding, CAVLC, or CABAC, and outputs quantized values of transform coefficients of syntax elements and residuals required for image reconstruction. More specifically, the CABAC entropy decoding method may receive a bin corresponding to each syntax element in a bitstream, determine a context model using decoding target syntax element information, decoding information of a decoding target block, or information of symbols (symbol)/bin decoded in a previous stage, and arithmetically decode the bin by predicting an occurrence probability of the bin according to the determined context model, and generate a symbol corresponding to a value of each syntax element. In this case, after determining the context model, the CABAC entropy decoding method may update the context model by using information of the decoded symbol/bin for the context model of the next symbol/bin. Information related to prediction among the information decoded by the entropy decoder 310 may be provided to predictors (the inter predictor 332 and the intra predictor 331), and residual values on which entropy decoding is performed in the entropy decoder 310 (that is, quantized transform coefficients and related parameter information) may be input to the residual processor 320. The residual processor 320 may derive residual signals (residual block, residual samples, residual sample array). In addition, information regarding filtering among information decoded by the entropy decoder 310 may be provided to the filter 350. In addition, a receiver (not shown) for receiving a signal output from the encoding apparatus may be further configured as an internal/external element of the decoding apparatus 300, or the receiver may be a component of the entropy decoder 310. Further, the decoding apparatus according to the present document may be referred to as a video/image/picture decoding apparatus, and the decoding apparatus may be classified into an information decoder (video/image/picture information decoder) and a sample decoder (video/image/picture sample decoder). The information decoder may include the entropy decoder 310, and the sample decoder may include at least one of a dequantizer 321, an inverse transformer 322, an adder 340, a filter 350, a memory 360, an inter predictor 332, and an intra predictor 331.

The dequantizer 321 may dequantize the quantized transform coefficient and output the transform coefficient. The dequantizer 321 may rearrange the quantized transform coefficients in the form of a two-dimensional block. In this case, the rearrangement may be performed based on the coefficient scan order performed in the encoding apparatus. The dequantizer 321 may perform dequantization on the quantized transform coefficient by using a quantization parameter (e.g., quantization step information) and obtain a transform coefficient.

The inverse transformer 322 inverse-transforms the transform coefficients to obtain a residual signal (residual block, residual sample array).

The predictor may perform prediction on the current block and generate a prediction block including prediction samples of the current block. The predictor may determine whether to apply intra prediction or inter prediction to the current block based on information regarding prediction output from the entropy decoder 310, and may determine a specific intra/inter prediction mode.

The predictor 320 may generate a prediction signal based on various prediction methods described below. For example, the predictor may not only apply intra prediction or inter prediction to predict one block, but also apply both intra prediction and inter prediction. This may be referred to as Combined Inter and Intra Prediction (CIIP). In addition, the predictor may predict the block based on an Intra Block Copy (IBC) prediction mode or a palette mode. The IBC prediction mode or palette mode may be used for content image/video coding, e.g., Screen Content Coding (SCC), of games and the like. IBC basically performs prediction in a current picture, but may be performed similarly to inter prediction because a reference block is derived in the current picture. That is, IBC may use at least one of the inter prediction techniques described in this document. The palette mode may be considered as an example of intra coding or intra prediction. When the palette mode is applied, the sample values within the picture may be signaled based on information about the palette table and palette indices.

The intra predictor 331 may predict the current block by referring to samples in the current picture. Depending on the prediction mode, the referenced samples may be located near the current block or may be located far away from the current block. In intra prediction, the prediction modes may include a plurality of non-directional modes and a plurality of directional modes. The intra predictor 331 may determine a prediction mode applied to the current block by using a prediction mode applied to the neighboring block.

The inter predictor 332 may derive a prediction block for the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. In this case, in order to reduce the amount of motion information transmitted in the 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 also include inter prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter prediction, the neighboring blocks may include spatial neighboring blocks existing in a current picture and temporal neighboring blocks existing in a reference picture. For example, the inter predictor 332 may configure a motion information candidate list based on neighboring blocks and derive a motion vector and/or a reference picture index of the current block based on the received candidate selection information. Inter prediction may be performed based on various prediction modes, and the information on prediction may include information indicating a mode of inter prediction with respect to the current block.

The adder 340 may generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the obtained residual signal to a prediction signal (prediction block, predicted sample array) output from a predictor (including the inter predictor 332 and/or the intra predictor 331). If the block to be processed has no residual (e.g., when skip mode is applied), the predicted block may be used as a reconstructed block.

The adder 340 may be referred to as a reconstructor or a reconstruction block generator. The generated reconstructed signal may be used for intra prediction of a next block to be processed in a current picture, may be output through filtering as described below, or may be used for inter prediction of a next picture.

In addition, a luminance map with chroma scaling (LMCS) may be applied in the picture decoding process.

Filter 350 may improve subjective/objective image quality by applying filtering to the reconstructed signal. For example, the filter 350 may generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture and store the modified reconstructed picture in the memory 360 (specifically, the DPB of the memory 360). The various filtering methods may include, for example, deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, and so on.

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 a current picture is derived (or decoded) and/or motion information of a reconstructed block in a picture. The stored motion information may be sent to the inter predictor 260 to be utilized as motion information of a spatial neighboring block or motion information of a temporal neighboring block. The memory 360 may store reconstructed samples of a reconstructed block in a current picture and may transmit the reconstructed samples to the intra predictor 331.

In the present disclosure, the embodiments described in the filter 260, the inter predictor 221, and the intra predictor 222 of the encoding apparatus 200 may be the same as or applied to correspond to the filter 350, the inter predictor 332, and the intra predictor 331 of the decoding apparatus 300, respectively. The same applies to the inter predictor 332 and the intra predictor 331.

As described above, the encoding apparatus may perform various encoding methods, such as exponential golomb, Context Adaptive Variable Length Coding (CAVLC), and Context Adaptive Binary Arithmetic Coding (CABAC). In addition, the decoding apparatus may decode information in a bitstream based on an encoding method such as exponential golomb encoding, CAVLC, or CABAC, and output a value of a syntax element required for image reconstruction and a quantized value of a transform coefficient related to a residual.

For example, the above-described compiling method may be performed as described below.

Fig. 4 exemplarily shows context-adaptive binary arithmetic coding (CABAC) for encoding a syntax element. For example, in the CABAC encoding process, when the input signal is a syntax element instead of a binary value, the encoding apparatus may convert the input signal into the binary value by binarizing the value of the input signal. In addition, when the input signal is already a binary value (i.e., when the value of the input signal is a binary value), binarization may not be performed and binarization may be bypassed. Here, each binary digit 0 or 1 constituting a binary value may be referred to as bin. For example, if the binary string after binarization is 110, each of 1, and 0 is referred to as one bin. A bin of one syntax element may indicate a value of the syntax element.

Thereafter, the binarized bin of syntax elements may be input to either a conventional coding engine or a bypass coding engine. A conventional coding engine of the encoding device may assign a context model reflecting a probability value to a corresponding bin, and may encode the corresponding bin based on the assigned context model. A conventional coding engine of the encoding apparatus may update a context model of each bin after performing encoding on each bin. A bin encoded as described above may be referred to as a context coding bin.

Meanwhile, when the bin of syntax elements is input to the bypass coding engine, they may be coded as follows. For example, the bypass coding engine of the coding apparatus omits a process of estimating a probability with respect to an input bin and a process of updating a probability model applied to the bin after coding. When applying bypass coding, the encoding apparatus may encode the input bin by applying a uniform probability distribution instead of assigning a context model, thereby increasing the encoding rate. A bin encoded as described above may be referred to as a bypass bin.

The entropy decoding may represent a process of performing the same process as the above-described entropy encoding in reverse order.

For example, when decoding a syntax element based on a context model, the decoding apparatus may receive a bin corresponding to the syntax element through a bitstream, determine the context model using the syntax element and decoding information of a decoding target block or a neighboring block or information of symbols/bins decoded in a previous stage, predict an occurrence probability of the received bin according to the determined context model, and perform arithmetic decoding on the bin to derive a value of the syntax element. Thereafter, the context model of the next decoded bin may be updated with the determined context model.

In addition, for example, when a syntax element is bypass-decoded, the decoding apparatus may receive a bin corresponding to the syntax element through the bitstream and decode the input bin by applying a uniform probability distribution. In this case, a process of the decoding apparatus for deriving a context model of a syntax element and a process of updating a context model applied to a bin after decoding may be omitted.

As described above, the residual samples may be derived as quantized transform coefficients through a transform and quantization process. The quantized transform coefficients may also be referred to as transform coefficients. In this case, the transform coefficients in the block may be signaled in the form of residual information. The residual information may include a residual coding syntax. That is, the encoding apparatus may configure a residual coding syntax with the residual information, encode it, and output it in the form of a bitstream, and the decoding apparatus may decode the residual coding syntax from the bitstream and derive residual (quantized) transform coefficients. The residual coding syntax may include syntax elements indicating whether a transform is applied to the corresponding block, the position of the last significant transform coefficient in the block, whether there are significant transform coefficients in sub-blocks, the size/sign of the significant transform coefficients, etc., as will be described later.

For example, (quantized) transform coefficients (i.e., residual information) may be encoded and/or decoded based on syntax elements such as: transform _ skip _ flag, last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, last _ sig _ coeff _ y _ suffix, coded _ sub _ block _ flag, sig _ coeff _ flag, par _ level _ flag, abs _ level _ gt1_ flag, abs _ level _ 3_ flag, abs _ remainder, coeff _ sign _ flag, dec _ abs _ level, and mts _ idx. Syntax elements related to residual data encoding/decoding can be represented as shown in the following table.

[ Table 1]

transform _ skip _ flag indicates whether a transform is skipped in the relevant block. transform _ skip _ flag may be a syntax element of the transform skip flag. The related block may be a Coding Block (CB) or a Transform Block (TB). CB and TB may be used interchangeably with respect to the transform (and quantization) and residual coding processes. For example, as described above, residual samples may be derived for CB, and (quantized) transform coefficients may be derived by transform and quantization for the residual samples and by a residual coding process, information (e.g., syntax elements) that effectively indicates the position, amplitude, sign, etc. of the (quantized) transform coefficients may be generated and signaled. The quantized transform coefficients may be simply referred to as transform coefficients. In general, when the CB is not greater than the maximum TB, the size of the CB may be the same as the size of the TB, and in this case, a target block to be transformed (and quantized) and residual coded may be referred to as the CB or the TB. Meanwhile, when CB is greater than the maximum TB, a target block to be transformed (and quantized) and residual coded may be referred to as TB. Hereinafter, it will be described that syntax elements related to residual coding are signaled in units of Transform Blocks (TBs), but this is an example and the TBs may be used interchangeably with coding blocks (CBs as described above).

Meanwhile, the syntax element signaled after signaling the transform skip flag may be the same as the syntax element disclosed in the following table 6, and a detailed description about the syntax element is described below.

Meanwhile, unlike in the foregoing embodiment in which the syntax element is transmitted, a method of signaling tu _ mts _ idx may be proposed.

Specifically, the method of signaling tu _ mts _ idx in conventional VVC draft 3 can be compared with the proposed method of signaling tu _ mts _ idx as follows.

[ Table 2]

As shown in table 2, according to the conventional method, the transform skip flag may be parsed after the MTS flag of the current block is parsed, and then the MTS index may be compiled. Herein, the coding of the MTS index may be performed by fixed-length binarization, and the fixed bit length of the MTS index may be 2.

On the other hand, according to the proposed method, the MTS index can be compiled without additionally parsing the transform skip flag and the MTS flag, and truncated unary binarization can be used in the compilation of the MTS index. Herein, the MTS index may indicate whether to apply a transform to residual information of the current block, and may indicate whether to apply the MTS. That is, the proposed method may be a method of signaling the transform skip flag, the MTS flag, and the MTS index as one syntax element. In the proposed method, a first bin of the MTS index may indicate whether to apply a transform to residual information of the current block, and a second bin of the MTS index may indicate whether to apply the MTS or may indicate a transform kernel to apply.

In the proposed method, the meaning indicated by the value of the MTS index and its binarized value can be as shown in the following table.

[ Table 3]

For example, if the value of the MTS index is 0, the MTS index may indicate that the transform for the current block is applied, MTS is not applied, and the horizontal transform kernel type and the vertical transform kernel type are DCT-2. In addition, if the value of the MTS index is 1, the MTS index may indicate that the transform for the current block is not applied (i.e., MTS is not applied, and a transform kernel type is not indicated). In addition, if the value of the MTS index is 2, the MTS index may indicate that the transform and the MTS for the current block are applied, and the horizontal transform kernel type and the vertical transform kernel type are DST-7. In addition, if the value of the MTS index is 3, the MTS index may indicate that the transform and MTS for the current block are applied, the horizontal transform kernel type is DCT-8, and the vertical transform kernel type is DST-7. In addition, if the value of the MTS index is 4, the MTS index may indicate that the transform and MTS for the current block are applied, the horizontal transform kernel type is DST-7, and the vertical transform kernel type is DCT-8. In addition, if the value of the MTS index is 5, the MTS index may indicate that the transform and the MTS of the current block are applied, and the horizontal transform kernel type and the vertical transform kernel type are DCT-8.

Alternatively, another example of the meaning indicated by the value of the MTS index and the binarized value thereof may be as shown in the following table.

[ Table 4]

For example, if the value of the MTS index is 0, the MTS index may indicate that the transform for the current block is not applied (i.e., MTS is not applied, and the transform kernel type is not indicated). In addition, if the value of the MTS index is 1, the MTS index may indicate that a transform for the current block is applied, MTS is not applied, and the horizontal transform kernel type and the vertical transform kernel type are DCT-2. In addition, if the value of the MTS index is 2, the MTS index may indicate that the transform and the MTS for the current block are applied, and the horizontal transform kernel type and the vertical transform kernel type are DST-7. In addition, if the value of the MTS index is 3, the MTS index may indicate that the transform and MTS for the current block are applied, the horizontal transform kernel type is DCT-8, and the vertical transform kernel type is DST-7. In addition, if the value of the MTS index is 4, the MTS index may indicate that the transform and MTS for the current block are applied, the horizontal transform kernel type is DST-7, and the vertical transform kernel type is DCT-8. In addition, if the value of the MTS index is 5, the MTS index may indicate that the transform and the MTS for the current block are applied, and the horizontal transform kernel type and the vertical transform kernel type are DCT-8.

Meanwhile, the number of context models may not change, and a method of specifying a context index increment ctxInc for each bin of tu _ mts _ idx may be as shown in the following table.

[ Table 5]

The proposed MTS index may also be represented by a unified MTS index.

Syntax elements related to the encoding/decoding of residual data including the unified MTS index may be as shown in the following table.

[ Table 6]

Referring to table 6 above, last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, last _ sig _ coeff _ y _ suffix, coded _ sub _ block _ flag, sig _ coeff _ flag, abs _ level _ 1_ flag, par _ level _ flag, abs _ level _ 3_ flag, abs _ remainders, dec _ abs _ level, and/or coeff _ sign _ flag may be encoded/decoded.

In an embodiment, the encoding apparatus may encode (x, y) position information of a last non-zero transform coefficient in the transform block based on syntax elements last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, and last _ sig _ coeff _ y _ suffix. More specifically, last _ sig _ coeff _ x _ prefix denotes a prefix of a column position of the last significant coefficient in the scanning order within the transform block, last _ sig _ coeff _ y _ prefix denotes a prefix of a row position of the last significant coefficient in the scanning order within the transform block, last _ sig _ coeff _ x _ suffix denotes a suffix of a column position of the last significant coefficient in the scanning order within the transform block, and last _ sig _ coeff _ y _ suffix denotes a suffix of a row position of the last significant coefficient in the scanning order within the transform block. Here, the significant coefficient may represent a non-zero coefficient. In addition, the scan order may be a right diagonal scan order. Alternatively, the scan order may be a horizontal scan order or a vertical scan order. The scan order may be determined based on whether intra/inter prediction is applied to a target block (CB or CB including TB) and/or a specific intra/inter prediction mode.

Thereafter, the encoding apparatus may divide the transform block into 4x4 sub-blocks and then use a 1-bit syntax element coded sub block flag for each 4x4 sub-block to indicate whether there are non-zero coefficients in the current sub-block.

If the value of the coded _ sub _ block _ flag is 0, there is no more information to transmit, and thus the encoding apparatus may terminate the encoding process for the current subblock. In contrast, if the value of the coded _ sub _ block _ flag is 1, the encoding apparatus may continue to perform the encoding process on the sig _ coeff _ flag. Since the subblock including the last non-zero coefficient does not need to encode the coded sub _ block _ flag and the subblock including the DC information of the transform block has a high probability of including a non-zero coefficient, the coded sub _ block _ flag may not be coded and its value may be assumed to be 1.

If the value of the coded _ sub _ block _ flag is 1 and thus it is determined that a non-zero coefficient exists in the current subblock, the encoding apparatus may encode the sig _ coeff _ flag having a binary value according to an inverse scan order. The encoding apparatus may encode the 1-bit syntax element sig _ coeff _ flag of each transform coefficient according to a scan order. The value of sig _ coeff _ flag may be 1 if the value of the transform coefficient at the current scanning position is not 0. Here, in the case where a subblock includes the last non-zero coefficient, sig _ coeff _ flag does not need to be encoded for the last non-zero coefficient, so the coding process for the subblock may be omitted. Level information coding can be performed only when sig _ coeff _ flag is 1, and four syntax elements can be used in the level information coding process. More specifically, each sig _ coeff _ flag [ xC ] [ yC ] may indicate whether the level (value) of the corresponding transform coefficient at each transform coefficient position (xC, yC) in the current TB is non-zero. In an embodiment, sig _ coeff _ flag may correspond to an example of a syntax element of a significant coefficient flag indicating whether a quantized transform coefficient is a non-zero significant coefficient.

The level values remaining after coding sig _ coeff _ flag may be derived as shown in the following equation. That is, a syntax element remAbsLevel indicating a level value to be encoded may be derived from the following equation.

[ equation 1]

remAbsLevel=|coeff|-1

In this context, coeff means the actual transform coefficient value.

Additionally, abs _ level _ 1_ flag may indicate whether the remABsLeve 1' of the corresponding scan position (n) is greater than 1. For example, when the value of abs _ level _ gt1_ flag is 0, the absolute value of the transform coefficient of the corresponding position may be 1. In addition, when the value of abs _ level _ gt1_ flag is 1, remABsLeve1 indicating a level value to be encoded later may be derived as shown in the following equation.

[ equation 2]

remAbsLevel=remAbsLevel-1

In addition, the least significant coefficient (LSB) value of the remAbsLevel described in the above equation 2 may be encoded by par _ level _ flag as in the following equation 3.

[ equation 3]

par_level_flag=|coeff|&1

Herein, par _ level _ flag [ n ] may indicate the parity of the transform coefficient level (value) at the scanning position n.

The transform coefficient level value remAbsLevel to be encoded after performing par _ level _ flag encoding may be updated as shown in the following equation.

[ equation 4]

remAbsLevel=remAbsLevel>>1

abs _ level _ 3_ flag may indicate whether the remABslevel' for the corresponding scan position (n) is greater than 3. Encoding may be performed on abs _ remaining only if rem _ abs _ gt3_ flag is equal to 1. The relationship between the actual transform coefficient value coeff and each syntax element may be as shown in the following equation.

[ equation 5]

coeff|=sig_coeff_flag+abs_level_gt1_flag+par_level_flag+2*(abs_level_gt3_flag+abs_remainder)

Additionally, the following table indicates an example related to equation 5 above.

[ Table 7]

Herein, | coeff | indicates a transform coefficient level (value) and may also be indicated as AbsLevel of a transform coefficient. Additionally, the sign of each coefficient may be encoded by using coeff _ sign _ flag as a 1-bit symbol (symbol).

Meanwhile, as an example different from the example in the foregoing embodiment of transmitting syntax elements, a scheme of coding different residuals according to whether a transform skip is applied for residual coding, that is, an embodiment of transmitting different residual syntax elements according to whether a transform skip is applied, may be proposed.

Syntax elements for residual coding according to the foregoing example may be shown in the following table.

[ Table 8]

[ Table 9]

[ Table 10]

According to the present embodiment, as shown in table 8, residual coding may be divided according to the value of the syntax element transform _ skip _ flag of the transform skip flag. That is, different syntax elements may be used for residual coding based on the value of the transform skip flag (based on whether the transform is skipped). Residual coding used when transform skip is not applied (that is, when transform is applied) may be referred to as Regular Residual Coding (RRC), and residual coding used when transform skip is not applied (that is, when transform is not applied) may be referred to as Transform Skip Residual Coding (TSRC). The above table 9 may show residual coded syntax elements when the value of transform _ skip _ flag is 0 (i.e., when transform is applied), and the above table 10 may show residual coded syntax elements when the value of transform _ skip _ flag is 1 (i.e., when transform is not applied).

Specifically, for example, a transform skip flag indicating whether to skip a transform of a transform block may be parsed, and it may be determined whether the transform skip flag is 1. If the value of the transform skip flag is 1, as shown in table 10, syntax elements sig _ coeff _ flag, coeff _ sign _ flag, abs _ level _ gtx _ flag, and/or abs _ remaining of the residual coefficients of the transform block may be parsed and the residual coefficients may be derived based on these syntax elements. In this case, the syntax elements may be sequentially parsed, and the parsing order may be changed. In addition, abs _ level _ gtx _ flag may represent abs _ level _ 1_ flag, abs _ level _ 3_ flag, abs _ level _ 5_ flag, abs _ level _ 7_ flag, and/or abs _ level _ gt9_ flag. For example, abs _ level _ gtx _ flag [ n ] [ j ] may indicate whether the absolute value of the transform coefficient level at the scanning position n (or a value obtained by shifting the transform coefficient level to the right by 1) is greater than (j < <1) + 1. The condition (j < <1) +1 may be optionally replaced with a specific threshold value such as a first threshold value, a second threshold value, or the like.

In addition, if the value of the transform skip flag is 0, as shown in table 9, syntax elements of the residual coefficients of the transform block, i.e., sig _ coeff _ flag, abs _ level _ gtx _ flag, par _ level _ flag, abs _ remaining, dec _ abs _ level, and coeff _ sign _ flag, may be parsed and the residual coefficients may be derived based on these syntax elements. In this case, the syntax elements may be sequentially parsed, and the parsing order may be changed. In addition, abs _ level _ gtx _ flag may represent abs _ level _ gt1_ flag and/or abs _ level _ gt3_ flag. For example, abs _ level _ gtx _ flag [ n ] [0] may be an example of a first transform coefficient level flag abs _ level _ gt1_ flag, and abs _ level _ gtx _ flag [ n ] [1] may be an example of a second transform coefficient level flag abs _ level _ gt3_ flag.

As described above, the syntax element of the residual coefficient when the transform is not applied is compared with the syntax element of the residual coefficient when the transform is applied, and the syntax element par _ level _ flag may not be encoded and decoded. When the residual coefficients have large level values, the possibility of transmitting information in a repetitive manner is high when syntax elements such as sig _ coeff _ flag, par _ level _ flag, abs _ level _ gtx _ flag, and the like of all the residual coefficients are coded, compared to transmission in which the level values of the residual coefficients are directly subjected to binarization. Therefore, in the present embodiment, coding efficiency can be improved by omitting the syntax element par _ level _ flag when a transform skip having a possibility that the level value of the residual coefficient is high is applied.

Meanwhile, CABAC provides high performance but disadvantageously has poor throughput performance. This is caused by the conventional coding engine of CABAC. Conventional coding (i.e., coding by a conventional coding engine of CABAC) exhibits high data dependency because it uses probability states and ranges that are updated by the coding of previous bins, and it may take a lot of time to read the probability intervals and determine the current state. The throughput problem of CABAC can be solved by limiting the number of bins for context coding. For example, as shown in table 1, table 6, table 9, or table 10 described above, the sum of bins used to express sig _ coeff _ flag, abs _ level _ gt1_ flag, par _ level _ flag, and abs _ level _ gt3_ flag may be limited to the number of bins depending on the size of the corresponding block. For example, if the corresponding block is a block of a size of 4x4, the sum of bins for the sig _ coeff _ flag, abs _ level _ 1_ flag, par _ level _ flag, and abs _ level _ 3_ flag may be limited to 32, and if the corresponding block is a block of a size of 2x2, the sum of bins for the sig _ coeff _ flag, abs _ level _ gt1_ flag, par _ level _ flag, abs _ level _ 3_ flag may be limited to 8. The limited number of bins may be represented by remBinsPass 1.

In this case, if a limited number of bins are coded using all contexts when the context elements are coded, the encoding apparatus may binarize the remaining coefficients by a method of binarizing coefficients as described below, instead of using CABAC, and may perform bypass encoding. In other words, for example, if the number of bins coded for a context coded of 4x4CG is 32, or if the number of bins coded for a context coded of 2x2CG is 8, sig _ coeff _ flag, abs _ level _ 1_ flag, par _ level _ flag, and abs _ level _ 3_ flag coded with the context coded bins may not be encoded any more and may be directly encoded as dec _ abs _ level as shown in table 8 below.

[ Table 11]

|coeff| dec_abs_level
0 0
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
... ...

The value | coeff | may be derived based on dec _ abs _ level. In this case, the transform coefficient value, i.e., | coeff |, may be derived as shown in the following equation.

[ equation 6]

|coeff|=dec_abs_level

In addition, coeff _ sign _ flag may indicate a sign of a transform coefficient level at the corresponding scanning position n. That is, coeff _ sign _ flag may indicate the sign of the transform coefficient at the corresponding scan position n. In addition, the mts _ idx may indicate a transform core applied to residual samples in the current transform block in the horizontal and vertical directions.

Fig. 5 shows an example of transform coefficients in a 4x4 block.

The 4 × 4 block of fig. 5 represents an example of quantized coefficients. The block of fig. 5 may be a 4x4 transform block, or a 4x4 sub-block of an 8x8, 16x16, 32x32, or 64x64 transform block. The 4x4 block of fig. 5 may represent a luminance block or a chrominance block.

For example, the encoding results for the inverse diagonal scan coefficients of fig. 5 may be as shown in the following table.

[ Table 12]

scan-pos 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Coefficient of performance 0 0 0 0 1 -1 0 2 0 3 -2 -3 4 6 -7 10
sig_coeff_flag 0 0 0 0 1 1 0 1 0 1 1 1 1 1
abs_level_gt1_flag 0 0 1 1 1 1 1 1
par_level_flag 0 1 0 1 0 0
abs_level_gt3_flag 1 1
abs_remainder 0 1
dec_abs_level 7 10
coeff_sign_flag 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0

In the above table 12, scan _ pos indicates the position of the coefficient based on the inverse diagonal scan. scan _ pos15 may be the transform coefficient to be scanned first (i.e., at the bottom right corner) in a 4x4 block, while scan _ pos0 may be the transform coefficient to be scanned last (i.e., at the top left corner). Meanwhile, in one embodiment, scan _ pos may be referred to as a scan position. For example, scan _ pos0 will be referred to as scan position 0.

Meanwhile, as described above, when the input signal is not a binary value but a syntax element, the encoding apparatus may transform the input signal into a binary value by binarizing the value of the input signal. In addition, the decoding device may decode the syntax element to derive a binarization value (e.g., bin) of the syntax element, and may de-binarize the binarization value to derive a value of the syntax element. The binarization process may be performed as a Truncated Rice (TR) binarization process, a k-th order exponential golomb (EGk) binarization process, a limited k-th order exponential golomb (limited EGk), a Fixed Length (FL) binarization process, and so on. In addition, the binarization process may represent a process performed based on a TR binarization process, an EGk binarization process, or a FL binarization process to derive a value of the syntax element.

For example, the TR binarization process may be performed as follows.

The inputs to the TR binarization process may be cMax and cRiceParam for the syntax elements and a request for TR binarization. In addition, the output of the TR binarization process may be TR binarization for symbolVal, which is the value corresponding to the bin string.

Specifically, for example, in the case where a suffix bin string of a syntax element is present, the TR bin string of the syntax element may be a concatenation of a prefix bin string and the suffix bin string, and in the case where the suffix bin string is not present, the TR bin string of the syntax element may be the prefix bin string. For example, the prefix bin string may be derived as follows.

The prefix value of symbolVal of the syntax element can be derived as shown in the following equation.

[ equation 7]

prefixVal=symbolVal>>cRiceParam

Herein, prefixVal may represent a prefix value of symbolVal. The prefix of the TR bin string of syntax elements (i.e., the prefix bin string) may be derived as follows.

For example, if prefixVal is less than cMax > > cRiceParam, the prefix bin string may be a bit string of length prefixVal +1 indexed by binIdx. That is, if prefixVal is less than cMax > > cRiceParam, the prefix bin string may be a bit string with the number of bits prefixVal +1 indicated by binIdx. The bin in which binIdx is less than prefixVal may be equal to 1. In addition, the bin of the same binIdx as prefixVal may be equal to 0.

For example, bin strings derived by unary binarization for prefixVal can be shown in the following table.

[ Table 13]

Meanwhile, if prefixVal is not less than cMax > > cRiceParam, the prefix bin string may be a bit string of length cMax > > cRiceParam and all bits are 1.

Additionally, if cMax is greater than symbolVal and if cRiceParam is greater than 0, then there may be a bin suffix bin string of the TR bin string. For example, the suffix bin string may be derived as follows.

The suffix value of symbolVal of the syntax element can be derived as shown in the following equation.

[ equation 8]

suffixVal=symbolVal-((prefixVal)<<cRiceParam)

Herein, suffixVal may represent a suffix value of symbolVal.

The suffix of the TR bin string (i.e., the suffix bin string) may be derived based on the FL binarization process for a suffixVal with a value cMax of (1< < cRiceParam) -1.

Meanwhile, if the value of the input parameter, namely, cRiceParam, is 0, TR binarization may be unary binarization that is exactly truncated, and may always use the same value cMax as the possible maximum value of the syntax element to be decoded.

In addition, for example, EGk binarization processing may be performed as follows. The syntax element compiled with ue (v) may be a syntax element subject to exponential golomb compilation.

For example, a 0 th order exponential golomb (EG0) binarization process may be performed as follows.

The parsing process of the syntax element may start with reading bits including the first non-zero bit starting at the current position of the bitstream and counting the number of leading bits equal to 0. The process can be represented as shown in the following table.

[ Table 14]

In addition, the variable 'codeNum' may be derived as shown in the following equation.

[ equation 9]

codeNum=2leadingZeroBits-1+read_bits(leadingZeroBits)

In this context, the value returned from the read _ bits (leading zerobits), i.e. the value indicated by the read _ bits (leading zerobits), may be interpreted as a binary representation of the unsigned integer of the most significant bit recorded first.

The structure of the exponential golomb code in which a bit string is divided into a "prefix" bit and a "suffix" bit can be represented as shown in the following table.

[ Table 15]

Bit string form Range of codeNum
1 0
0 1 x0 1..2
0 0 1 x1 x0 3..6
0 0 0 1 x2 x1 x0 7..14
0 0 0 0 1 x3 x2 x1 x0 15..30
0 0 0 0 0 1 x4 x3 x2 x1 x0 31..62
... ...

The "prefix" bit may be a bit that is parsed as described above to compute a leadingZeroBit, and may be represented by a 0 or a 1 of the bit string in table 15. That is, the bit string disclosed by 0 or 1 in the above table 15 may represent a prefix bit string. The "suffix" bits may be bits parsed in the calculation of codeNum and may be represented by xi in table 15 above. That is, the bit string disclosed as xi in table 15 above may represent a suffix bit string. In this context, i may be a value in the LeadingZeroBits-1 range. In addition, each xi may be equal to 0 or 1.

The bit string assigned to codeNum can be shown in the following table.

[ Table 16]

Bit string codeNum
1 0
0 1 0 1
0 1 1 2
0 0 1 0 0 3
0 0 1 0 1 4
0 0 1 1 0 5
0 0 1 1 1 6
0 0 0 1 0 0 0 7
0 0 0 1 0 0 1 8
0 0 0 1 0 1 0 9
... ...

If the descriptor of the syntax element is ue (v), that is, if the syntax element is compiled with ue (v), the value of the syntax element may be equal to codeNum.

In addition, for example, EGk binarization processing may be performed as follows.

EGk the input to the binarization process may be a request for EGk binarization. Additionally, the output of the EGk binarization process may be EGk binarization for symbolVal, the value corresponding to the bin string.

The bit string for the EGk binarization process for symbolVal can be derived as follows.

[ Table 17]

Referring to table 17 above, a binary value X may be added to the end of the bin string with each call of put (X). Here, X may be 0 or 1.

In addition, for example, the limited EGk binarization process may be performed as follows.

The inputs to the restricted EGk binarization process may be a request for restricted EGk binarization, a rice parameter riceParam, a log2TransformRange as a variable representing the base-2 logarithm of the maximum value, and a maxPreExtLen as a variable representing the maximum prefix extension length. In addition, the output of the restricted EGk binarization process may be restricted EGk binarization for symbolVal as the value corresponding to the null string.

The bit string for the restricted EGk binarization process for symbolVal can be derived as follows.

[ Table 18]

In addition, for example, the FL binarization process may be performed as follows.

The input to the FL binarization process may be a request for FL binarization and the cMax of the syntax elements. In addition, the output of the FL binarization process may be FL binarization for symbolVal as the value corresponding to the bin string.

FL binarization can be configured by using a bit string having a fixed length of symbolVal as the number of bits. Herein, the fixed length bits may be an unsigned integer bit string. That is, a bit string of symbolVal as a symbol value can be derived by FL binarization, and the bit length (i.e., the number of bits) of the bit string may be a fixed length.

For example, the fixed length may be derived as shown in the following equation.

[ equation 10]

fixedLength=Ceil(Log2(cMax+1))

The index to the bin for FL binarization may be a method using values that sequentially increase from the most significant bit to the least significant bit. For example, the bin index associated with the most significant bit may be bin idx ═ 0.

Meanwhile, for example, a binarization process for the syntax element abs _ remaining in the residual information may be performed as follows.

The input to the binarization process for abs _ remaining may be a request for binarization of the syntax elements abs _ remaining [ n ], the color components cIdx, and the luminance positions (x0, y 0). The luma location (x0, y0) may indicate the top-left sample of the current luma transform block based on the top-left luma sample of the picture.

The output of the binarization process for abs _ remainders may be the binarization of abs _ remainders (i.e., the binarization bin string of abs _ remainders). The available bin strings for abs _ remaining may be derived by a binarization process.

First, lastAbsRemander and lastTriceParam for abs _ remainder [ n ] can be derived as follows. Herein, lastabsremander may represent a value of abs _ remaining derived before abs _ remaining [ n ], and lastricepaam may represent a rice parameter cRiceParam of abs _ remaining derived before abs _ remaining [ n ].

For example, if the processes of lastabbsremander and lastricepam to derive abs _ remaining [ n ] are first called for the current subblock, that is, if the process of abs _ remaining [ n ] of the transform coefficient of the first order in the scanning order is performed among the transform coefficients of the current subblock, both lastabbsremander and lastricepam may be set to 0.

In addition, if this is not the case, that is, if the procedure is not called first for the current subchunk, lastabebslemandinder and lastricepaam may be set to be the same as abs _ remainder [ n ] and cRiceParam, respectively, which were derived in the last call. That is, lastAbsRefemander may be derived to the same value as abs _ remaining [ n ] compiled before abs _ remaining [ n ] currently to be compiled, and lastTriceParam may be derived to the same value as cRiceParam of abs _ remaining [ n ] compiled before abs _ remaining [ n ].

Thereafter, the rice parameter cRiceParam for abs _ remaining [ n ] currently to be compiled may be derived based on lastabsremander and lastricepam. For example, the rice parameter cRiceParam for abs _ remainder [ n ] that is currently to be compiled may be derived as shown in the following equation.

[ equation 11]

cRiceParam=Min(lastRiceParam+((lastAbsRemainder>(3*(1<<lastRiceParam)))?1:0),3)

In addition, the cMax of abs _ remaining [ n ] that is currently to be compiled may be derived based on the Rice parameter cRiceParam, for example. The cMax can be derived as shown in the following equation.

[ equation 12]

cMax=6<<cRiceParam

Alternatively, the rice parameter cRiceParam may be determined based on whether transform skipping is applied to the current block, for example. That is, if no transform is applied to the current TB including the current CG, in other words, if a transform skip is applied to the current TB including the current CG, the rice parameter cRiceParam may be derived as 1. Alternatively, if a transform is applied to the current TB including the current CG, in other words, if no transform skip is applied to the current TB including the current CG, the rice parameter cRiceParam of abs _ remainder [ n ] to be currently compiled as described above may be derived to the same value as the cRiceParam of the previously compiled abs _ remainder [ n ].

Meanwhile, the binarization for abs _ remaining, i.e., the bin string for abs _ remaining, may be a concatenation of a prefix bin string and a suffix bin string in the presence of a suffix bin string. In addition, in the absence of a suffix bin string, the bin string for abs _ remaining may be a prefix bin string.

For example, the prefix bin string may be derived as follows.

The prefix value prefixVal of abs _ remaining [ n ] can be derived as shown in the following equation.

[ equation 13]

prefixVal=Min(cMax,abs_remainder[n])

The prefix of the bin string (i.e., the prefix bin string) of abs _ remainder [ n ] may be derived by the TR binarization process for prefixVal, with cMax and cRiceParam used as inputs.

If the prefix bin string is the same as a bit string with all bits 1 and a bit length of 6, a suffix bin string of the bin string of abs _ remaining [ n ] may exist and may be derived as described below.

The suffix value suffixVal of abs _ remainder can be derived as shown in the following equation.

[ equation 14]

suffixVal=abs_remainder[n]-cMax

The suffix bin string of the bin string of abs _ remainder may be derived by a restricted EGk binarization process for the suffixVal, where k is set to cRiceParam +1, riceParam is set to cRiceParam, and log2TransformRange is set to 15, and maxPreExtLen is set to 11.

Meanwhile, for example, a binarization process for the syntax element dec _ abs _ level in the residual information may be performed as follows.

The input to the binarization process for dec _ abs _ level may be a request for binarization of the syntax element dec _ abs _ level [ n ], the color component cIdx, the luminance position (x0, y0), the current coefficient scan position (xC, yC), log2TbWidth, which is the base-2 logarithm of the width of the transform block, and log2TbHeight, which is the base-2 logarithm of the height of the transform block. The luma location (x0, y0) may indicate the top-left sample of the current luma transform block based on the top-left luma sample of the picture.

The output of the binarization process for dec _ abs _ level may be binarization of dec _ abs _ level (i.e., a binarization bin string of dec _ abs _ level). The available bin string for dec _ abs _ level may be derived by a binarization process.

The rice parameter cRiceParam of dec abs level n may be derived by a rice parameter derivation process performed as an input of the color component cIdx, luminance position (x0, y0), current coefficient scan position (xC, yC), log2TbWidth as a base-2 logarithm of the width of the transform block, and log2TbHeight as a base-2 logarithm of the height of the transform block. The derivation process of the rice parameter will be described in detail below.

In addition, for example, the cMax of dec _ abs _ level [ n ] may be derived based on the rice parameter cRiceParam. cMax can be derived as shown in the following equation.

[ equation 15]

cMax=6<<cRiccParam

Meanwhile, the bin string used for binarization of dec _ abs _ level [ n ], i.e., dec _ abs _ level [ n ], may be a concatenation of a prefix bin string and a suffix bin string in the presence of the suffix bin string. In addition, in the case where there is no suffix bin string, the bin string of dec _ abs _ level [ n ] may be a prefix bin string.

For example, the prefix bin string may be derived as follows.

The prefix value prefixVal of dec _ abs _ level [ n ] can be derived as shown in the following equation.

[ equation 16]

prcfixVal=Min(cMax,dec_abs_level[n])

The prefix of the bin string of dec _ abs _ level [ n ] (i.e., the prefix bin string) may be derived by the TR binarization process for prefixVal, where cMax and cRiceParam are used as inputs.

If the prefix bin string is the same as a bit string with all bits 1 and a bit length of 6, a suffix bin string of the bin string of dec _ abs _ level [ n ] may exist and may be derived as described below.

The rice parameter derivation procedure for dec _ abs _ level [ n ] may be as follows.

The inputs to the rice parameter derivation process may be the color component index cIdx, the luma position (x0, y0), the current coefficient scan position (xC, yC), log2TbWidth, which is the base-2 logarithm of the width of the transform block, and log2TbHeight, which is the base-2 logarithm of the height of the transform block. The luma location (x0, y0) may indicate the top-left sample of the current luma transform block based on the top-left luma sample of the picture. Additionally, the output of the rice parameter derivation process may be the rice parameter cRiceParam.

For example, the variable locSumAbs may be derived based on a given syntax element sig _ coeff _ flag [ x ] [ y ] and an array AbsLevel [ x ] [ y ] of transform blocks having a component index cIdx and an upper-left luminance position (x0, y0) similar to the pseudo-code disclosed in the following table.

[ Table 19]

The rice parameter cRiceParam can be derived as follows.

For example, the rice parameter cRiceParam may be derived based on the derived variable locSumAbs and the variable s. The variable s may be set to Max (0, QState-1). That is, variable s may be set to a maximum value between 0 and QState-1.

Zeropos [ n ] and a rice parameter, cRiceParam, derived based on the variable locSumAbs and the variable s, can be shown in the following table.

[ Table 20]

S locSumAbs 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cRiceParam 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2
0 ZeroPos[n] 0 0 0 0 0 1 2 2 2 2 2 2 4 4 4 4
1 ZeroPos[n] 1 1 1 1 2 3 4 4 4 6 6 6 8 8 8 8
2 ZeroPos[n] 1 1 2 2 2 3 4 4 4 6 6 6 8 8 8 8
locSumAbs 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
cRiceParam 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3
0 ZeroPos[n] 4 4 4 4 4 4 4 8 8 8 8 8 16 16 16 16
1 ZeroPos[n] 4 4 12 12 12 12 12 12 12 12 16 16 16 16 16 16
2 ZeroPos[n] 8 8 12 12 12 12 12 12 12 16 16 16 16 16 16 16

For example, referring to table 20 above, if locSumAbs is less than or equal to 6, cRiceParam may be set to 0. The cricepparam may be set to 1 if locSumAbs are greater than or equal to 7 and less than or equal to 13. The cricepparam may be set to 2 if locSumAbs are greater than or equal to 14 and less than or equal to 27. If locSumAbs is greater than or equal to 28, cRiceParam may be set to 3.

In addition, referring to table 20 above, if s is 0 and locSumAbs is less than or equal to 4, ZeroPos [ n ] may be set to 0. If s is 0 and locSumAbs is 5, then Zeropos [ n ] may be set to 1. ZeroPos [ n ] may be set to 2 if s is 0 and locSumAbs are greater than or equal to 6 and less than or equal to 11. If s is 0 and locSumAbs is greater than or equal to 12 and less than or equal to 22, Zeropos [ n ] may be set to 4. ZeroPos [ n ] may be set to 8 if s is 0 and locSumAbs are greater than or equal to 23 and less than or equal to 27. If s is 0 and locSumAbs is greater than or equal to 28, then Zeropos [ n ] may be set to 16. In addition, referring to Table 20 above, if locSumAbs is less than or equal to 3, Zeropos [ n ] may be set to 1. If s is 1 and locSumAbs is 4, Zeropos [ n ] may be set to 2. If s is 1 and locSumAbs is 5, Zeropos [ n ] may be set to 3. ZeroPos [ n ] may be set to 4 if s is 1 and locSumAbs are greater than or equal to 6 and less than or equal to 8. If s is 1 and locSumAbs is greater than or equal to 9 and less than or equal to 11, Zeropos [ n ] may be set to 6. ZeroPos [ n ] may be set to 8 if s is 1 and locSumAbs are greater than or equal to 12 and less than or equal to 15. If s is 1 and locSumAbs is greater than or equal to 16 and less than or equal to 17, Zeropos [ n ] may be set to 4. If s is 1 and locSumAbs is greater than or equal to 18 and less than or equal to 25, Zeropos [ n ] may be set to 12. If locSumAbs is greater than or equal to 26 and less than or equal to 31, Zeropos [ n ] may be set to 16. In addition, referring to table 20 above, if s is 2 and locSumAbs is less than or equal to 1, ZeroPos [ n ] may be set to 1. If s is 2 and locSumAbs is greater than or equal to 2 and less than or equal to 4, Zeropos [ n ] may be set to 2. If s is 2 and locSumAbs is 5, Zeropos [ n ] may be set to 3. If s is 2 and locSumAbs is greater than or equal to 6 and less than or equal to 8, Zeropos [ n ] may be set to 4. If s is 2 and locSumAbs is greater than or equal to 9 and less than or equal to 11, Zeropos [ n ] may be set to 6. If s is 2 and locSumAbs is greater than or equal to 12 and less than or equal to 17, Zeropos [ n ] may be set to 8. If s is 2 and locSumAbs is greater than or equal to 18 and less than or equal to 24, Zeropos [ n ] may be set to 12. If s is 2 and locSumAbs is greater than or equal to 25, Zeropos [ n ] may be set to 16.

The suffix value suffixVal of dec _ abs _ level [ n ] may be derived as shown in the following equation.

[ equation 17]

suffixVal=dec_abs_level[n]-cMax

The suffix bin string of the bin string of dec _ abs _ level [ n ] may be derived by a restricted EGk binarization process for suffixVal, where k is set to cRiceParam +1, ricceparam is set to cRiceParam, log2TransformRange is set to 15, and maxPreExtLen is set to 11.

In addition, the present disclosure proposes a method of modifying, in an existing residual coding method, such that statistics and signal characteristics indicating a transform skip level of a quantized prediction residual (i.e., a residual in a spatial domain) are suitable for residual coding.

Scanning sequence: for example, the scanning order of the sub-blocks in the TB block and the residual coefficients in the sub-blocks may be a diagonal scanning order moving from bottom right to top left. That is, the scanning order of the sub-blocks in the TB block and the residual coefficients in the sub-blocks may be a diagonal scanning order that scans from bottom right to top left. Alternatively, the scanning order of the sub-blocks in the TB block and the residual coefficients in the sub-blocks may be a diagonal scanning order from top left to bottom right, for example. That is, the scanning order of the sub-blocks in the TB block and the residual coefficients in the sub-blocks may be a diagonal scanning order that scans from top left to bottom right.

The position where the last non-zero transform coefficient does not exist: after prediction, the residual signal (i.e., residual samples) may no longer have a high probability for subsequent zero or non-significant levels below and to the right of the transform block, since the spatial residual is applied and transform-based energy compression is not performed per transform skip. Thus, in this case, the signaling of information about the scan position of the last non-zero transform coefficient may be skipped. Alternatively, the first sub-block to be coded first may be the upper left sub-block in the transform block. Meanwhile, the non-zero residual coefficients may also be referred to as significant coefficients.

Sub-block CBF: the members of the signaling of information about the scan position of the last non-zero transform coefficient should modify the CBF signaling of the subblocks skipped by the applied transform and having the coded _ sub _ block _ flag as described below.

Due to the quantization, the aforementioned sequence of non-significant levels may still be generated locally within the transform block. Accordingly, information on the scan position of the last non-zero transform coefficient may be removed as described above, and the coded _ sub _ block _ flag may be coded for all subblocks.

In addition, coded _ sub _ block _ flag for the sub-block of the DC frequency position (upper left sub-block) may indicate a special case. For example, in VVC draft 3, the coded _ sub _ block _ flag of the upper left subblock may not be signaled and may be derived to always be equal to 1. When the scanning position of the last non-zero transform coefficient is located at a sub-block other than the upper-left sub-block, this may indicate that there is at least one significance level outside the DC sub-block (i.e., the upper-left sub-block). As a result, the coded _ sub _ block _ flag of the DC subblock may be derived as 1, but may include only 0/non-significant level. If transform skip is applied to the current block as described above and there is no information on the scan position of the last non-zero transform coefficient, the coded _ sub _ block _ flag of each sub-block may be signaled. Herein, the coded _ sub _ block _ flag of the DC subblock may be included, except for the case where the coded _ sub _ block _ flag for all subblocks except the DC subblock has been 0. Meanwhile, for example, when a diagonal scan order moving from bottom right to top left is applied as a scan order of the transform block and a coded _ sub _ block _ flag of the DC sub-block is not signaled, the coded _ sub _ block _ flag of the DC sub-block may be derived to be equal to 1 (interferedcsbcbf ═ 1). Therefore, since the DC subblock should have at least one active level, if all sig _ coeff _ flags except the sig _ coeff _ flag of the first position (0,0) in the DC subblock are 0, the sig _ coeff _ flag of the first position (0,0) may not be signaled and may be derived to be equal to 1 (preferringsbdcsigcoeffflag ═ 1).

In addition, there may be a change in the context modeling of the coded _ sub _ block _ flag. For example, the context model index may be calculated as the sum of the coded _ sub _ block _ flag of the left subblock of the current subblock and the coded _ sub _ block _ flag of the upper subblock of the current subblock and the logical separation of these coded _ sub _ block _ flags.

sig _ coeff _ flag context modeling: the local template of sig _ coeff _ flag context modeling may be modified to include only the left position NB0 and the upper position NB1 of the current scan position. The context model offset may be derived as the value of the significant neighbor location, i.e., sig _ coeff _ flag [ NB0] + sig _ coeff _ flag [ NB1 ]. Thus, the selection of different sets of contexts depending on the diagonal d of the current transform block can be removed. Therefore, three context models and a single context model may be set to compile sig _ coeff _ flag.

abs _ level _ 1_ flag and par _ level _ flag context modeling: a single context model may be used for abs _ level _ gt1_ flag and par _ level _ flag.

abs _ remainder compiled: although the empirical distribution of transform skip residual absolute levels still fits the laplacian or geometric distribution, there may be instability that is greater than the transform coefficient absolute levels. In particular, for residual absolute levels, the variance within a continuously implemented window may be higher. Thus, the context modeling and binarization of abs _ remaining can be modified as follows.

For example, a higher cutoff (cutoff) value may be used in the binarization of abs _ remaining. Therefore, higher compression efficiency can be provided for the dedicated context model for the transition point and each bin position from coding with sig _ coeff _ flag, abs _ level _ 1_ flag, par _ level _ flag, and abs _ level _ 3_ flag to rice code for abs _ remaining. Increasing the cutoff may generate more "greater than X" flags (e.g., abs _ level _ gt5_ flag, abs _ level _ gt7_ flag, etc.) until the cutoff is reached. The cutoff can be fixed to 5(numGtFlags ═ 5).

In addition, the template used to derive the rice parameter may be modified. That is, only the right-neighboring position and the lower-neighboring position of the current scanning position may be considered as local templates for sig _ coeff _ flag context modeling.

coeff _ sign _ flag context modeling: even if the global empirical distribution is almost evenly distributed due to instability inside the symbol sequence and the fact that the prediction residuals are often biased, the context model can be used to compile information about the symbols. A single dedicated context model may be used in the coding of the symbol related information and the symbol related information may be parsed after sig _ coeff _ flag to keep all context coded bins together.

Reduction of bins for context compilation: the transmission of the syntax elements sig _ coeff _ flag, abs _ level _ 1_ flag, and par _ level _ flag of the first scan pass (pass) may not be modified. However, the constraint of the maximum value of bin (ccb) of per-sample context compilation may be removed and may be adjusted differently. When CCB > k, the reduction in CCB can be deduced by specifying a non-valid mode. Herein, k may be a positive integer. For example, in the case of a regular level coding mode, k may be 2. The aforementioned constraint may correspond to a reduction of the quantization space.

Syntax elements related to residual data compiled by applying the aforementioned modifications can be represented as shown in the following table.

[ Table 21]

Meanwhile, a context index ctxIdx indicating a context model of a syntax element coded based on a context included in the aforementioned residual information may be derived as described below.

For example, the input of the process of deriving the context index of the syntax element may be binIdx indicating the position of the current bin in the bin string of the syntax element, and ctxTable, ctxIdx, and bypassFlag may be derived as outputs.

First, ctxInc of the current bin of syntax elements may be derived. That is, ctxIdx may be derived based on binIdx indicating the position of the current bin of the syntax element. ctxInc may be represented by a context increment parameter.

ctxInc derived based on binIdx of syntax elements can be shown in the following table.

[ Table 22]

In table 22, the context index of a bin having a value other than "bypass", "terminate", or "na (not applicable)" can be derived as follows.

ctxInc of the current bin of the syntax element may be derived as the value of the entry in table 22 designated as the current bin. In addition, ctxInc may be derived through the process of the terms given in parentheses in the item if multiple values are specified as items of the current bin. The above clauses may imply the clauses disclosed in the VVC standard. Thereafter, the variable ctxIdxOffset may be specified as the lowest value of ctxIdx according to the current value of initType. In addition, the context index ctxIdx of the current bin of the syntax element may be set equal to the sum of ctxInc and ctxIdxOffset. That is, the context index may be set to the sum of ctxInc and ctxIdxOffset. In addition, bypass flag may be set to 0.

Meanwhile, if the entry of the current bin is "bypass" in table 22, the context index of the bin may be derived as follows. For example, ctxTable of the current bin may be set to 0. In addition, the context index ctxIdx of the current bin may be set to 0. In addition, bypassFlag may be set to 1.

Meanwhile, if the entry of the current bin is "terminated" in table 22, the context index of the bin may be derived as follows. For example, ctxTable of the current bin may be set to 0. In addition, the context index ctxIdx of the current bin may be set to 0. In addition, bypass flag may be set to 0.

Meanwhile, if the entry of the current bin is "na (not applicable)" in the table 22, a syntax element of the bin, i.e., a context index of the bin, may be derived as follows. For example, ctxIdx, ctxTable, and/or bypassFlag may not occur for the current bin.

The procedure for deriving the terms of ctxInc for bins having values other than "bypass", "terminate", or "na (not applicable)" may be as follows.

For example, the process of deriving ctxInc based on clause 9.5.4.2.2 may be as shown in the following table.

[ Table 23]

In addition, for example, the process of deriving ctxInc based on clause 9.5.4.2.3 may be as shown in the following table.

[ Table 24]

In addition, for example, the process of deriving ctxInc based on clause 9.5.4.2.4 may be as shown in the following table.

[ Table 25]

In addition, for example, the process of deriving ctxInc based on clause 9.5.4.2.5 may be as shown in the following table.

[ Table 26]

In addition, for example, the process of deriving ctxInc based on clause 9.5.4.2.6 may be as shown in the following table.

[ Table 27]

In addition, for example, the process of deriving ctxInc based on clause 9.5.4.2.7 may be as shown in the following table.

[ Table 28]

In addition, for example, the process of deriving ctxInc based on clause 9.5.4.2.8 may be as shown in the following table.

[ Table 29]

Meanwhile, as described above, since a block that is not subjected to transform coding, i.e., a transform block including residual coefficients to which a transform is not applied, has different characteristics from those of a block subjected to typical transform coding, an efficient residual data encoding method is required for the block that is not subjected to transform coding. Meanwhile, as described above, the transform skip flag indicating whether to apply the transform may be transmitted on a transform block basis, and the size of the transform block is not limited in this disclosure. For example, if the value of the transform skip flag is 1, the residual information encoding/decoding method proposed in the present disclosure may be performed, and if the value of the transform skip flag is 0, the conventional residual information encoding/decoding method described in table 1, table 6, or table 9 above may be performed. Alternatively, if the transform skip flag indicates that no transform is applied to the current block (the transform is skipped), the residual information encoding/decoding method in the transform skip mode disclosed in table 10 or table 21 above may be performed.

Meanwhile, if no transform is applied to the current block, transform coefficients may be derived using residual samples. Thus, if a transform is skipped, the residual samples may also be referred to as coefficients or residual coefficients.

As described above in table 1, table 6, or table 9, for residual encoding/decoding, after the significant coefficient flag, the first transform coefficient level flag, the parity level flag, and the second transform level flag may be encoded/decoded, the syntax element of the remaining level value, that is, abs _ remaining or dec _ abs _ level, may be encoded/decoded, and thereafter, the sign flag of each residual coefficient may be encoded/decoded. Herein, the significant coefficient flag may be a sig _ coeff _ flag, and the parity level flag may be a par _ level _ flag, the first transform coefficient level flag may be abs _ level _ 1_ flag, and the second transform coefficient level flag may be abs _ level _ 3_ flag or abs _ level _ gtx _ flag. In addition, the symbol flag may be the aforementioned coeff _ sign _ flag.

Meanwhile, the symbol flags may be encoded/decoded as described in the method shown in the above table 21. In this case, the symbol flag may be encoded/decoded based on the context model, unlike in table 1, table 6, or table 9 above where the symbol flag is subjected to bypass coding.

Herein, in the case of a transform skip block (i.e., a block to which a transform is not applied), since a transform is not applied, there is a case where residual coefficients in the transform skip block have similar signs to those of residual coefficients adjacent thereto.

Therefore, the present embodiment of the present disclosure proposes a method in which a context table (ctxTable) of sign flags of transform skipped residual coefficients, i.e., transform skipped blocks, is determined based on the sign flags of residual coefficients encoded/decoded immediately before the residual coefficients, and the sign flags of the residual coefficients are context coded based on the determined context table. That is, the present embodiment proposes a method in which a context model of a sign flag of a residual coefficient in a current sub-block of a current block is determined based on a sign flag of a residual coefficient coded before the residual coefficient in the current sub-block, and the sign flag is coded based on the determined context model.

Unlike in the symbol flag encoding/decoding disclosed in table 1, table 6, or table 21 above in the Coefficient Group (CG) of the transform block, the symbol flag may be context-encoded/decoded to improve compression performance in the present embodiment. CG may also be expressed by sub-blocks. In addition, the sign flag encoding/decoding disclosed in the above table 21 uses only one context model, unlike the present embodiment in which coding is performed by using a context model determined based on the sign flag of a residual coefficient coded before the residual coefficient among a plurality of context models.

According to this embodiment, the sign flag may be coded by taking into account high correlation with neighboring residual coefficients. Since the sign flags of the neighboring residual coefficients in the transform skip block tend to have similar values as described above, by considering the foregoing aspect, the present embodiment proposes a method in which, when the sign flags of the residual coefficients in the current sub-block are encoded/decoded, two context models (or context tables) are selected based on the value (0 or 1) of the sign flag of the immediately preceding residual coefficient according to the coefficient scan order. Meanwhile, when residual coefficients in the current sub-block are coded for the first time among the residual coefficients in the current sub-block, a context model of a sign flag of the residual coefficients may be derived as a predefined context model (e.g., context model 0). The compression performance of the residual information can be improved by the foregoing embodiments. Meanwhile, a context model may be indicated based on ctxidx or ctxinc, and ctxidx may be derived based on ctxinc.

In addition, as another embodiment, the present disclosure may propose a method of selecting one of M context models by using any N (N > ═ 1) sign flags encoded/decoded immediately before the residual coefficients in the current sub-block. For example, based on the sign flags of two residual coefficients encoded/decoded before the current residual coefficient in the current sub-block, the context model of the sign flag of the current residual may be derived as one of three context models. Alternatively, for example, based on the sign flags of two residual coefficients encoded/decoded before the current residual coefficient in the current sub-block, the context model of the sign flag of the current residual may be derived as one of six context models. Meanwhile, when residual coefficients in the current sub-block are coded for the first time among the residual coefficients of the current sub-block, a context model of a sign flag of the residual coefficients may be derived as a predefined context model (e.g., context model 0).

For example, when the current sub-block includes five non-zero residual coefficients, if the value of the sign flag of the non-zero residual coefficient is (0,0,0,1,0), the context model value of the sign flag of the non-zero residual coefficient may be defined as (0,0,0,0, 1). Herein, a context model value may indicate a context model. That is, if the context model value is 0, the context model value may indicate the context model 0, and if the context model value is 1, the context model value may indicate the context model 1. In this embodiment, the pseudo code may be as shown in the following table.

[ Table 30]

Meanwhile, an embodiment of a context model to derive a symbol flag proposed in the present disclosure may be defined as shown in the following table.

[ Table 31]

The ctxInc derivation process disclosed in table 31 above may be as follows.

1. The last symbol flag (the symbol flag encoded/decoded immediately before the symbol flag to be coded) is input.

2. And outputting the final symbol mark as ctxInc. That is, the value of the last symbol flag is output as ctxInc.

Alternatively, embodiments of the context model proposed in the present disclosure to derive symbolic signs may be defined as shown in the following table.

[ Table 32]

Referring to table 32 above, a context model of a bin of a syntax element coeff _ sign _ flag (i.e., a symbol flag) of a current residual coefficient may be determined based on a lastcoeffsign flag. Specifically, for example, a context model of a bin of a syntax element coeff _ sign _ flag of the current residual coefficient may be determined based on ctxinc, and ctxinc may be derived as 0 if a value of lastcoffsignflag is 0 and may be derived as 1 if the value of lastcoffsignflag is 1. Herein, lastcoffsignflag may be the same as a value of coeff _ sign _ flag of a residual coefficient immediately before the current residual coefficient according to a coefficient scan order in the current CG (i.e., the current sub-block). Meanwhile, if the current residual coefficient is the first residual coefficient in the current CG, lastcoeffsign flag may be set to 0. That is, the initial value of lastcoffsignflag may be set to 0.

That is, according to this embodiment, a context model of a bin of a coeff _ sign _ flag of a current residual coefficient may be adaptively determined based on a value of coeff _ sign _ flag of a previous residual coefficient of the current residual coefficient in an order of coefficient scanning among residual coefficients in the current CG. Accordingly, a bin of coeff _ sign _ flag of the current residual coefficient may be decoded, and a value of coeff _ sign _ flag of the current residual coefficient may be derived. Therefore, the correlation of neighboring residual coefficients can be considered and coding gain can be increased. By using the value of coeff _ sign _ flag for the current residual coefficient, the sign of the current residual sample can be derived as described above.

Meanwhile, after the ctxinc of coeff _ sign _ flag of the current residual coefficient is derived as described above, a process of deriving a context model based on the coeff _ sign _ flag may be performed as described above.

Specifically, ctxIdxOffset of the symbol flag may be derived as the minimum of the possible values of ctxIdx of the symbol flag. For example, in the above description, since ctxIdx (a context model index indicating a context model) can be derived as 0 (i.e., context model 0) or 1 (i.e., context model 1), ctxIdxOffset can be derived as 0. Thereafter, ctxIdx of the symbol flag may be derived as the sum of ctxIdxOffset and ctxinc. Since ctxIdxOffset is derived as 0, ctxIdx of the symbol flag may be the same as ctxinc.

Meanwhile, the foregoing embodiment may be applied to all transform skip blocks. Alternatively, since the sign flag is encoded/decoded only for non-zero residual coefficients, it may be more preferable to apply the aforementioned embodiment only when the number of non-zero residual coefficients to be subjected to sign flag encoding/decoding is greater than or equal to a certain value. Accordingly, when the residual coding methods described in tables 1 to 6 are used, the number of previously coded non-zero residual coefficients may be derived, and whether a sign flag will be subjected to context coding or bypass coding may be determined according to the number of non-zero residual coefficients. That is, for example, if the number of non-zero residual coefficients of the current sub-block is greater than or equal to a certain value, the sign flag may be coded based on the context model, and if the number of non-zero residual coefficients of the current sub-block is less than the certain value, the sign flag may be subjected to bypass coding. For example, the specific value may be 5. In particular, for example, if the number of non-zero residual coefficients of the current sub-block is greater than or equal to 5, the sign flag may be coded based on the context model, while if the number of non-zero residual coefficients of the current sub-block may be less than 5, the sign flag may be subject to bypass coding. Meanwhile, if the current sub-block is a block of 4x4 size, the number of non-zero residual coefficients may be one of values in the range of 0 to 16, and if the current sub-block is a block of 2x2 size, the number of non-zero residual coefficients may be one of values in the range of 0 to 4. The present disclosure does not limit the order in which the symbol flags are coded and may be applied to any step after determining the presence/absence of non-zero residual coefficients of the current sub-block.

Alternatively, an embodiment of determining whether to perform context coding/bypass coding on a symbol flag may be proposed based on the number of non-zero residual coefficients and a specific value derived depending on the size of the current block. Herein, the number of non-zero residual coefficients used as the threshold, i.e., a specific value, may be one of values in the range of 0 to the number of samples of the current block (block including the current sub-block), or may be controlled on a sub-block basis and thus may be one of values in the range of 0 to 16 in the case of a 4x4 sub-block and 0 to 4 in the case of a 2x2 sub-block. That is, a specific value may be derived based on the current block or the size of the current block, and if the number of non-zero residual coefficients of the current sub-block is greater than or equal to the specific value, the sign flag may be coded based on the context mode, and if the number of non-zero residual coefficients of the current sub-block is less than the specific value, the sign flag may be subjected to bypass coding.

For example, when the size of the current block is 8x8 size, a specific value may be derived as 5, and if the number of non-zero residual coefficients of the current sub-block is greater than or equal to 5, the sign flag may be coded based on the context model, and if the number of non-zero residual coefficients of the current sub-block is less than 5, the sign flag may be subjected to bypass coding. In addition, when the size of the current block is 4x4 size, a specific value may be derived as 4, and if the number of non-zero residual coefficients of the current sub-block is greater than or equal to 4, the sign flag may be coded based on the context model, and if the number of non-zero residual coefficients of the current sub-block is less than 4, the sign flag may be subjected to bypass coding.

Alternatively, an embodiment of determining whether a symbol flag will be subjected to context coding/bypass coding may be proposed based on the size of the current block, a specific value derived depending on the position of the current sub-block, and the number of non-zero residual coefficients. Herein, the number of non-zero residual coefficients used as the threshold, i.e., the specific value, may be one of values in the range of 0 to the number of samples of the current block (block including the current sub-block), or may be controlled on a sub-block basis and thus may be one of values in the range of 0 to 16 in the case of a 4x4 sub-block and 0 to 4 in the case of a 2x2 sub-block. That is, a specific value may be derived based on the size of the current block or the current block and the position of the current sub-block, and if the number of non-zero residual coefficients of the current sub-block is greater than or equal to the specific value, the sign flag may be coded based on the context mode, and if the number of non-zero residual coefficients of the current sub-block is less than the specific value, the sign flag may be subjected to bypass coding.

For example, when the size of the current block is 8x8 size and the current sub-block is CG #3 encoded in a first order among orders determined by a diagonal scan order, a specific value may be derived as 5, and if the number of non-zero residual coefficients of the current sub-block is greater than or equal to 5, the sign flag may be coded based on a context model, and if the number of non-zero residual coefficients of the current sub-block is less than 5, the sign flag may be subjected to bypass coding. Herein, CG #3 may be the lower right sub-block. In addition, when the size of the current block is 8x8 size and the current sub-block is CG #0 among orders determined by a diagonal scan order, the sign flag may be coded based on a context model regardless of the number of non-zero residual coefficients of the current sub-block. That is, a specific value may be derived as 0. Herein, CG #0 may be the upper left sub-block.

Alternatively, an embodiment of determining whether a symbol flag will be subjected to context coding/bypass coding may be proposed based on the size of the current block, a specific value derived depending on the position of the current sub-block, and the prediction mode and the number of non-zero residual coefficients of the current block. Herein, the number of non-zero residual coefficients used as the threshold, i.e., a specific value, may be one of values in the range of 0 to the number of samples of the current block (block including the current sub-block), or may be controlled on a sub-block basis and thus may be one of values in the range of 0 to 16 in the case of a 4x4 sub-block and 0 to 4 in the case of a 2x2 sub-block. That is, a specific value may be derived based on the size of the current block or the current block, the position of the current sub-block, and the prediction mode of the current block, and if the number of non-zero residual coefficients of the current sub-block is greater than or equal to the specific value, the symbol flag may be coded based on the context mode, and if the number of non-zero residual coefficients of the current sub-block is less than the specific value, the symbol flag may be subjected to bypass coding.

For example, when the size of the current block is 8x8 size and the current sub-block is CG #3 encoded in a first order among orders determined by a diagonal scan order and if the prediction mode of the current block is an intra prediction mode, a specific value may be derived as 5, whereas if the number of non-zero residual coefficients of the current sub-block is greater than or equal to 5, a sign flag may be coded based on a context model, and if the number of non-zero residual coefficients of the current sub-block is less than 5, the sign flag may be subjected to bypass coding. Herein, CG #3 may be the lower right sub-block. In addition, if the current sub-block is CG #0 among orders determined by a diagonal scan order, the sign flag may be coded based on a context model regardless of the number of non-zero residual coefficients of the current sub-block. That is, a specific value may be derived as 0. Herein, CG #0 may be the upper left sub-block.

Alternatively, it may be determined whether the symbol flag is to be coded based on the context model or to be bypass coded based on whether the transform is applied to the current block.

Fig. 6 illustrates an example of performing encoding by determining a method of coding a symbol flag based on whether a transform is applied to a current block.

Referring to fig. 6, the encoding apparatus may determine whether to apply a transform to the current block (S600).

If the transform is applied to the current block, the encoding apparatus may encode a sign flag of a current residual coefficient of the current sub-block based on two context models (S610). As described above, the encoding apparatus may determine one of the context models as the context model of the sign flag of the current residual coefficient based on the sign flag of the residual coefficient encoded before the current residual coefficient in the current sub-block. For example, when the sign flag value of a residual coefficient coded before the current residual coefficient is 0, context model 0 may be selected as the context model of the sign flag, and if the sign flag value of a residual coefficient coded before the current residual coefficient is 1, context model 1 may be selected as the context model of the sign flag. The encoding apparatus may encode a sign flag of the current residual coefficient based on the determined context model.

If no transform is applied to the current block, the encoding apparatus may bypass-encode a sign flag of a current residual coefficient of the current sub-block (S620).

Fig. 7 illustrates an example of performing decoding by determining a method of coding a symbol flag based on whether a transform is applied to a current block.

Referring to fig. 7, the decoding apparatus may determine whether to apply a transform to the current block (S700). The decoding apparatus may determine whether to apply a transform to the current block based on the transform skip flag of the current block.

If the transform is applied to the current block, the decoding apparatus may decode a sign flag of a current residual coefficient of the current sub-block based on two context models (S710). As described above, the decoding apparatus may determine one of the context models as the context model of the sign flag of the current residual coefficient based on the sign flag of the residual coefficient decoded before the current residual coefficient in the current sub-block. For example, when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 0, context model 0 may be selected as the context model of the sign flag, and if the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 1, context model 1 may be selected as the context model of the sign flag. The decoding device may decode the sign flag of the current residual coefficient based on the determined context model.

If no transform is applied to the current block, the decoding apparatus may bypass-decode a sign flag of a current residual coefficient of the current sub-block (S720).

Fig. 8 briefly illustrates an image encoding method performed by the encoding apparatus according to the present disclosure. The method disclosed in fig. 8 may be performed by the encoding device disclosed in fig. 2. Specifically, for example, S800 of fig. 8 may be performed by a residual processor of the encoding apparatus, and S810 to S830 may be performed by an entropy encoder of the encoding apparatus. In addition, although not shown, the process of deriving the prediction samples may be performed by a predictor of the encoding apparatus, the process of deriving the residual samples of the current block based on the original samples and the prediction samples of the current block may be performed by a subtractor of the encoding apparatus, and the process of generating the reconstructed samples and the reconstructed picture of the current block based on the residual samples and the prediction samples of the current block may be performed by an entropy encoder of the encoding apparatus.

The encoding apparatus derives current residual coefficients in a current sub-block of a current block (S800). The encoding device may determine whether to perform inter prediction or intra prediction in the current block, and may determine a specific inter prediction mode or a specific intra prediction mode based on the RD cost. The encoding apparatus may derive a predicted sample of the current block based on the determined mode, and may derive a residual sample by subtracting the original sample and the predicted sample of the current block.

Thereafter, the encoding apparatus may determine whether to apply a transform to the current block. That is, the encoding apparatus may determine whether to apply a transform to residual samples of the current block. The encoding apparatus may determine whether to apply the transform to the current block by considering coding efficiency. For example, the encoding device may determine that no transform is applied to the current block.

If no transform is applied to the current block, that is, if no transform is applied to the residual samples, the encoding apparatus may derive the derived residual samples as current residual coefficients. In addition, if a transform is applied to the current block, that is, if a transform is applied to the residual samples, the encoding apparatus may derive the current residual coefficients by performing a transform on the derived residual samples. The current residual coefficient may be included in a current sub-block of the current block. The current sub-block may be referred to as a current Coefficient Group (CG). In addition, the size of the current sub-block of the current block may be 4x4 size or 2x2 size. That is, the current sub-block of the current block may include a maximum of 16 non-zero residual coefficients or a maximum of 4 non-zero residual coefficients.

Meanwhile, the encoding apparatus may generate and encode a transform skip flag indicating whether to apply a transform to residual coefficients of the current block. The residual information may include a transform skip flag of the current block. The transform skip flag may indicate whether to apply a transform to residual coefficients of the current block. That is, the transform skip flag may indicate whether to apply a transform to the residual coefficients. The syntax element indicating the transform skip flag may be the aforementioned transform _ skip _ flag.

The encoding apparatus derives a context model of a sign flag of a current residual coefficient (S810).

For example, the encoding device may derive a context model for the sign flag of the current residual coefficient among a plurality of context models.

For example, a context model for a sign flag may be derived based on the sign flag for residual coefficients encoded prior to the current residual coefficient in the current sub-block. That is, a context model of a sign flag may be derived based on the sign flag of a residual coefficient that is encoded (or scanned) before the current residual coefficient in a coefficient scan order among residual coefficients in the current sub-block. For example, when the value of the sign flag of the residual coefficient coded before the current residual coefficient is 0, the value of the context index of the context model indicating the sign flag of the current residual coefficient may be derived as 0, and when the value of the sign flag of the residual coefficient coded before the current residual coefficient is 1, the value of the context index of the context model indicating the sign flag of the current residual coefficient may be derived as 1. That is, when the value of the sign flag of the residual coefficient encoded before the current residual coefficient is 0, the context model of the sign flag of the current residual coefficient may be derived as context model 0, and when the value of the sign flag of the residual coefficient encoded before the current residual coefficient is 1, the context model of the sign flag of the current residual coefficient may be derived as context model 1. Meanwhile, when the current residual coefficient is a residual coefficient that is first encoded in the current sub-block, a value of a context index of a context model indicating a sign flag of the current residual coefficient may be derived as 0. That is, when the current residual coefficient is the residual coefficient that is first encoded in the current sub-block, the context model of the sign flag of the current residual coefficient may be derived as context model 0.

Alternatively, in another example, a context model for a sign flag may be derived based on the sign flag for a plurality of residual coefficients encoded before a current residual coefficient in a current sub-block. The sign-flagged context model may be derived as one of a plurality of context models based on a sign flag of a plurality of residual coefficients encoded prior to a current residual coefficient in a current sub-block. For example, the sign-flagged context model may be derived as one of three context models based on the sign flags of two residual coefficients encoded before the current residual coefficient in the current sub-block. Alternatively, the sign-flagged context model may be derived as one of six context models, for example, based on the sign flags of two residual coefficients encoded before the current residual coefficient in the current sub-block.

Meanwhile, the encoding apparatus may determine whether to encode the sign flag based on the context model, and may derive the context model of the sign flag when it is determined to encode the sign flag based on the context model.

For example, based on the transform skip flag of the current block, the encoding apparatus may determine whether to encode the symbol flag based on the context model. That is, based on whether to apply a transform to the current block, the encoding apparatus may determine whether to encode the symbol flag based on the context model. The transform skip flag may indicate whether to apply a transform to the current block. That is, the transform skip flag may indicate whether to apply a transform to residual coefficients of the current block. The residual information of the current block may include a transform skip flag. If the value of the transform skip flag is 0, the symbol flag may not be encoded (that is, the symbol flag may be bypass-decoded) based on the context model, and if the value of the transform skip flag is 1, the symbol flag may be encoded based on the context model. That is, if the value of the transform skip flag is 1, it may be determined that the sign flag pair is encoded based on the context model, and the encoding apparatus may derive the context model of the sign flag and may encode the sign flag based on the context model.

Alternatively, for example, the encoding apparatus may determine whether to encode the sign flag based on the context model by comparing a specific value and the number of non-zero residual coefficients in the current sub-block. The sign flag may not be encoded (that is, the sign flag may be bypass-decoded) based on the context model when the number of non-zero residual coefficients is less than a certain value, and may be encoded based on the context model when the number of non-zero residual coefficients is greater than or equal to the certain value. In other words, when the number of non-zero residual coefficients is greater than or equal to a certain value, the encoding apparatus may determine that the sign flag is encoded based on the context model, and the encoding apparatus may derive the context model of the sign flag and may encode the sign flag based on the context model. A particular value may also be represented by a threshold.

Herein, for example, the specific value may be one of values ranging from 0 to the number of samples of the current block. For example, the specific value may be one of values in the range of 0 to 64. Alternatively, the specific value may be one of values ranging from 0 to the current number of sub-blocks, for example. That is, for example, if the size of the current subblock is a size of 4x4, the specific value may be one of values in a range of 0 to 16, and if the size of the current subblock is a size of 2x2, the specific value may be one of values in a range of 0 to 4. For example, the specific value may be 5.

Alternatively, for example, the specific value may be derived based on the size of the current block. For example, the specific value may be derived as 5 when the size of the current block is 8x8 size, and may be derived as 4 when the size of the current block is 4x4 size.

Alternatively, for example, the specific value may be derived based on the size of the current block and the position of the current sub-block in the current block.

For example, when the size of the current block is 8x8 size and the current sub-block is the lower-right sub-block of the current block, the specific value may be derived as 5. Herein, the lower right sub-block may be sub-block #3 (i.e., CG #3) in an order determined by a diagonal scan order.

In addition, for example, when the size of the current block is 8x8 size and the current sub-block is the upper left block of the current block, the specific value may be derived as 4. Herein, the upper left sub-block may be a sub-block #0 (or CG #0) in an order determined by a diagonal scan order.

Alternatively, the specific value may be derived based on the size of the current block, the position of the sub-block in the current block, and the prediction mode of the current block, for example.

For example, when the size of the current block is 8x8 size, the current sub-block is the lower-right sub-block of the current block, and the prediction mode of the current block is the intra prediction mode, the specific value may be derived as 5. That is, when the size of the current block is 8x8 size, the current sub-block is the lower-right sub-block of the current block, and the prediction mode applied to the current block is the intra prediction mode, the specific value may be derived as 5.

In addition, for example, when the size of the current block is 8x8 size, the current sub-block is the top-left sub-block of the current block, and the prediction mode of the current block is the intra prediction mode, a specific value may be derived as 0. That is, when the size of the current block is 8x8 size, the current sub-block is the top-left sub-block of the current block, and the prediction mode applied to the current block is the intra prediction mode, a specific value may be derived as 0. Thus, regardless of the number of non-zero residual coefficients, it may be determined that the sign flag is encoded based on the context model.

The encoding apparatus encodes the symbol flag based on the context model (S820). The encoding device may encode the symbolic marker based on a context model. That is, based on the context model, the encoding device may encode the symbol flag in a context-based manner. The sign flag may indicate the sign of the current residual coefficient. The sign flag may indicate that the current residual coefficient is a positive value when the value of the sign flag is 0, and may indicate that the current residual coefficient is a negative value if the value of the sign flag is 1. That is, if the value of the sign flag is 0, the current residual coefficient may be a positive value, and if the value of the sign flag is 1, the current residual coefficient may be a negative value.

In addition, the encoding apparatus may encode residual information of the current block.

The residual information may include syntax elements of residual coefficients in a current sub-block of the current block. The residual information may include syntax elements for current residual coefficients in a current sub-block of the current block. Herein, the syntax elements may include context-coded syntax elements and bypass-coded syntax elements (i.e., syntax elements coded based on a uniform probability distribution).

For example, the residual information may include syntax elements such as transform _ skip _ flag, last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, last _ sig _ coeff _ y _ suffix, coded _ sub _ block _ flag, sig _ coeff _ flag, par _ level _ flag, abs _ level _ 1_ flag, abs _ level _ gtx _ flag, abs _ remainder, coeff _ sign _ flag, dec _ abs _ level, and/or mts _ idx.

Specifically, for example, the residual information may include a transform skip flag of the current block. The transform skip flag may indicate whether to apply a transform of the current block. That is, the transform skip flag may indicate whether to apply a transform to residual coefficients of the current block. The syntax element indicating the transform skip flag may be the aforementioned transform _ skip _ flag.

In addition, for example, the residual information may include position information indicating a position of the last non-zero residual coefficient in the residual coefficient array of the current block. That is, the residual information may include position information indicating a position of the last non-zero residual coefficient in the scan order of the current block. The position information may comprise information indicating a prefix of a column position of the last non-zero residual coefficient, information indicating a prefix of a row position of the last non-zero residual coefficient, information indicating a suffix of a column position of the last non-zero residual coefficient, and information indicating a suffix of a row position of the last non-zero residual coefficient. Syntax elements of the position information may be last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, and last _ sig _ coeff _ y _ suffix. Meanwhile, the non-zero residual coefficients may also be referred to as significant coefficients.

In addition, for example, the residual information may include syntax elements coded based on a context of current residual coefficients in a current sub-block of the current block. These syntax elements may include a significant coefficient flag indicating whether the current residual coefficient is a non-zero residual coefficient, a parity level flag indicating the parity of the coefficient level of the current residual coefficient, a first coefficient level flag indicating whether the coefficient level is greater than a first threshold, and a second coefficient level flag indicating whether the coefficient level of the current residual coefficient is greater than a second threshold. Herein, the significant coefficient flag may be a sig _ coeff _ flag, the parity level flag may be a par _ level _ flag, the first coefficient level flag may be abs _ level _ 1_ flag, and the second coefficient level flag may be abs _ level _ 3_ flag or abs _ level _ gtx _ flag.

In addition, for example, the syntax element coded based on the context of the current residual coefficient may include a sign flag indicating the sign of the current residual coefficient. For example, if a transform is not applied to the current block (that is, if the value of the transform skip flag is 1), the context-coded syntax element may include a symbol flag. That is, if a transform is not applied to the current block (that is, if the value of the transform skip flag is 1), the symbol flag may be encoded based on the context model.

In addition, for example, the residual information may include syntax elements based on bypass coding for current residual coefficients in a current sub-block of the current block. The bypass-coded syntax element may include information related to a coefficient value of a value of the current residual coefficient. The information related to the coefficient values may be abs _ remaining and/or dec _ abs _ level. In addition, for example, if a transform is applied to the current block (that is, if the value of the transform skip flag is 0), the bypass-coded syntax element may include a symbol flag. That is, if a transform is applied to the current block (that is, if the value of the transform skip flag is 0), the symbol flag may be bypass-encoded (that is, the symbol flag may be encoded based on a uniform probability distribution).

The encoding apparatus generates a bitstream including a symbol flag (S830). For example, the encoding apparatus may output the image information as a bitstream, the image information including residual information, the residual information including a sign flag. The bitstream may include residual information.

Meanwhile, the bitstream may include prediction information of the current block. The prediction information may include information regarding an inter prediction mode or an intra prediction mode performed in the current block. The encoding apparatus may generate prediction information of the current block and encode it.

Meanwhile, the bitstream may be transmitted to a decoding apparatus through a network or a (digital) storage medium. Herein, the network may include a broadcasting network and/or a communication network, and the digital storage medium may include various storage media such as a Universal Serial Bus (USB), an SD, a Compact Disc (CD), a Digital Versatile Disc (DVD), a blu-ray disc, a Hard Disk Drive (HDD), a Solid State Drive (SSD), and the like.

Fig. 9 briefly illustrates an encoding apparatus for performing an image encoding method according to the present disclosure. The method disclosed in fig. 8 may be performed by the encoding device disclosed in fig. 9. Specifically, for example, the residual processor of the encoding apparatus of fig. 9 may perform S800 of fig. 8, and the entropy encoder of the encoding apparatus of fig. 9 may perform S810 to S830 of fig. 8. In addition, although not shown, the process of deriving the prediction sample may be performed by a predictor of the encoding apparatus, the process of deriving the reconstructed sample of the current block based on the prediction sample and the residual sample of the current block may be performed by an adder of the encoding apparatus, and the process of encoding the prediction information of the current block may be performed by an entropy encoder of the encoding apparatus.

Fig. 10 schematically illustrates an image decoding method performed by a decoding apparatus according to the present disclosure. The method disclosed in fig. 10 may be performed by the decoding device disclosed in fig. 3. Specifically, for example, S1000 to S1030 of fig. 10 may be performed by an entropy decoder of the decoding apparatus, S1040 may be performed by a residual processor of the decoding apparatus, and S1050 may be performed by an adder of the decoding apparatus. In addition, although not shown, the process of deriving the predicted samples may be performed by a predictor of the decoding apparatus.

The decoding apparatus receives residual information of a current block (S1000). The decoding apparatus may receive image information including residual information of the current block through a bitstream. Herein, the current block may be a Coding Block (CB) or a Transform Block (TB). The residual information may include syntax elements of residual coefficients in a current sub-block of the current block. The residual information may include syntax elements for current residual coefficients in a current sub-block of the current block. Herein, the syntax elements may include context-coded syntax elements and bypass-coded syntax elements (i.e., syntax elements coded based on a uniform probability distribution).

For example, the residual information may include syntax elements such as transform _ skip _ flag, last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, last _ sig _ coeff _ y _ suffix, coded _ sub _ block _ flag, sig _ coeff _ flag, par _ level _ flag, abs _ level _ 1_ flag, abs _ level _ gtx _ flag, abs _ remainder, coeff _ sign _ flag, dec _ abs _ level, and/or mts _ idx.

Specifically, for example, the residual information may include a transform skip flag of the current block. The transform skip flag may indicate whether to apply a transform of the current block. That is, the transform skip flag may indicate whether to apply a transform to residual coefficients of the current block. The syntax element indicating the transform skip flag may be the aforementioned transform _ skip _ flag.

In addition, for example, the residual information may include position information indicating a position of the last non-zero residual coefficient in the residual coefficient array of the current block. That is, the residual information may include position information indicating a position of the last non-zero residual coefficient in the scan order of the current block. The position information may comprise information indicating a prefix of a column position of the last non-zero residual coefficient, information indicating a prefix of a row position of the last non-zero residual coefficient, information indicating a suffix of a column position of the last non-zero residual coefficient, and information indicating a suffix of a row position of the last non-zero residual coefficient. Syntax elements of the position information may be last _ sig _ coeff _ x _ prefix, last _ sig _ coeff _ y _ prefix, last _ sig _ coeff _ x _ suffix, and last _ sig _ coeff _ y _ suffix. Meanwhile, the non-zero residual coefficients may also be referred to as significant coefficients.

In addition, for example, the residual information may include syntax elements coded based on a context of current residual coefficients in a current sub-block of the current block. These syntax elements may include a significant coefficient flag indicating whether the current residual coefficient is a non-zero residual coefficient, a parity level flag indicating the parity of the coefficient level of the current residual coefficient, a first coefficient level flag indicating whether the coefficient level is greater than a first threshold, and a second coefficient level flag indicating whether the coefficient level of the current residual coefficient is greater than a second threshold. Herein, the significant coefficient flag may be a sig _ coeff _ flag, the parity level flag may be a par _ level _ flag, the first coefficient level flag may be abs _ level _ 1_ flag, and the second coefficient level flag may be abs _ level _ 3_ flag or abs _ level _ gtx _ flag.

In addition, for example, the syntax element coded based on the context of the current residual coefficient may include a sign flag indicating the sign of the current residual coefficient. For example, if a transform is not applied to the current block (that is, if the value of the transform skip flag is 1), the context-coded syntax element may include a symbol flag. That is, if a transform is not applied to the current block (that is, if the value of the transform skip flag is 1), the symbol flag may be decoded based on the context model.

In addition, for example, the residual information may include syntax elements based on bypass coding for current residual coefficients in a current sub-block of the current block. The bypass-coded syntax element may include information related to a coefficient value of a value of the current residual coefficient. The information related to the coefficient values may be abs _ remaining and/or dec _ abs _ level. In addition, for example, if a transform is applied to the current block (that is, if the value of the transform skip flag is 0), the bypass-coded syntax element may include a symbol flag. That is, if a transform is applied to the current block (i.e., if the value of the transform skip flag is 0), the symbol flag may be bypass-decoded (i.e., the symbol flag may be decoded based on a uniform probability distribution)).

Meanwhile, the bitstream may include prediction information of the current block. The prediction information may include information regarding an inter prediction mode or an intra prediction mode performed in the current block. The decoding apparatus may perform inter prediction or intra prediction on the current block based on prediction information received through a bitstream, and may derive prediction samples of the current block.

The decoding apparatus derives a context model of a sign flag of a current residual coefficient in a current sub-block of the current block (S1010).

For example, the decoding device may derive a context model for the sign flag of the current residual coefficient among a plurality of context models.

For example, a context model for a sign flag may be derived based on the sign flag for residual coefficients decoded before the current residual coefficient in the current sub-block. That is, a context model of a sign flag may be derived based on the sign flag of a residual coefficient decoded (or scanned) before a current residual coefficient in a coefficient scan order among residual coefficients in a current sub-block. For example, when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 0, the value of the context index of the context model indicating the sign flag of the current residual coefficient may be derived as 0, and when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 1, the value of the context index of the context model indicating the sign flag of the current residual coefficient may be derived as 1. That is, when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 0, the context model of the sign flag of the current residual coefficient may be derived as context model 0, and when the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 1, the context model of the sign flag of the current residual coefficient may be derived as context model 1. Meanwhile, when the current residual coefficient is a residual coefficient that is first decoded in the current sub-block, a value of a context index of a context model indicating a sign flag of the current residual coefficient may be derived as 0. That is, when the current residual coefficient is a residual coefficient that is first decoded in the current sub-block, a context model of a sign flag of the current residual coefficient may be derived as context model 0.

Alternatively, in another example, a context model for a sign flag may be derived based on the sign flag for a plurality of residual coefficients decoded before a current residual coefficient in a current sub-block. The sign-flagged context model may be derived as one of a plurality of context models based on a sign flag of a plurality of residual coefficients decoded prior to a current residual coefficient in a current sub-block. For example, the sign-flagged context model may be derived as one of three context models based on the sign flags of two residual coefficients decoded before the current residual coefficient in the current sub-block. Alternatively, the sign-flagged context model may be derived as one of six context models, for example, based on the sign flags of two residual coefficients decoded before the current residual coefficient in the current sub-block.

Meanwhile, the decoding apparatus may determine whether to decode the symbol flag based on the context model, and may derive the context model of the symbol flag when it is determined to decode the symbol flag based on the context model.

For example, based on the transform skip flag of the current block, the decoding apparatus may determine whether to decode the symbol flag based on the context model. That is, based on whether to apply a transform to the current block, the decoding apparatus may determine whether to decode the symbol flag based on the context model. The transform skip flag may indicate whether to apply a transform to the current block. That is, the transform skip flag may indicate whether to apply a transform to residual coefficients of the current block. The residual information of the current block may include a transform skip flag. The symbol flag may not be decoded (that is, may be bypass-decoded) based on the context model if the value of the transform skip flag is 0, and may be decoded based on the context model if the value of the transform skip flag is 1. That is, if the value of the transform skip flag is 1, it may be determined that the symbol flag is decoded based on the context mode, and the decoding apparatus may derive a context model of the symbol flag and may decode the symbol flag based on the context model.

Alternatively, for example, the decoding apparatus may determine whether to decode the sign flag based on the context model by comparing a specific value and the number of non-zero residual coefficients in the current sub-block. The sign flag may not be decoded based on the context model (that is, the sign flag may be bypass-decoded) when the number of non-zero residual coefficients is less than a certain value, and may be decoded based on the context model when the number of non-zero residual coefficients is greater than or equal to the certain value. In other words, when the number of non-zero residual coefficients is greater than or equal to a certain value, the decoding apparatus may determine to decode the sign flag based on the context model, and the decoding apparatus may derive the context model of the sign flag and may decode the sign flag based on the context model. A particular value may also be represented by a threshold.

Herein, for example, the specific value may be one of values ranging from 0 to the number of samples of the current block. For example, the specific value may be one of values in the range of 0 to 64. Alternatively, the specific value may be one of values ranging from 0 to the current number of sub-blocks, for example. That is, for example, if the size of the current subblock is a size of 4x4, the specific value may be one of values in a range of 0 to 16, and if the size of the current subblock is a size of 2x2, the specific value may be one of values in a range of 0 to 4. For example, the specific value may be 5.

Alternatively, for example, the specific value may be derived based on the size of the current block. For example, the specific value may be derived as 5 when the size of the current block is 8x8 size, and may be derived as 4 when the size of the current block is 4x4 size.

Alternatively, for example, the specific value may be derived based on the size of the current block and the position of the current sub-block in the current block.

For example, when the size of the current block is 8x8 size and the current sub-block is the lower-right sub-block of the current block, the specific value may be derived as 5. Herein, the lower right sub-block may be sub-block #3 (i.e., CG #3) in an order determined by a diagonal scan order.

In addition, for example, when the size of the current block is 8x8 size and the current sub-block is the upper left block of the current block, the specific value may be derived as 4. Herein, the upper left sub-block may be a sub-block #0 (or CG #0) of an order determined by a diagonal scan order.

Alternatively, the specific value may be derived based on the size of the current block, the position of the sub-block in the current block, and the prediction mode of the current block, for example.

For example, when the size of the current block is 8x8 size, the current sub-block is the lower-right sub-block of the current block, and the prediction mode of the current block is the intra prediction mode, the specific value may be derived as 5. That is, when the size of the current block is 8x8 size, the current sub-block is the lower-right sub-block of the current block, and the prediction mode applied to the current block is the intra prediction mode, the specific value may be derived as 5.

In addition, for example, when the size of the current block is 8x8 size, the current sub-block is the top-left sub-block of the current block, and the prediction mode of the current block is the intra prediction mode, a specific value may be derived as 0. That is, when the size of the current block is 8x8 size, the current sub-block is the top-left sub-block of the current block, and the prediction mode applied to the current block is the intra prediction mode, a specific value may be derived as 0. Therefore, regardless of the number of non-zero residual coefficients, it may be determined to decode the sign flag based on the context model.

The decoding apparatus decodes the symbol flag based on the context model (S1020). The decoding device may decode the symbol flags based on the context model. The sign flag may indicate the sign of the current residual coefficient. The sign flag may indicate that the current residual coefficient is a positive value when the value of the sign flag is 0, and may indicate that the current residual coefficient is a negative value if the value of the sign flag is 1. That is, if the value of the sign flag is 0, the current residual coefficient may be a positive value, and if the value of the sign flag is 1, the current residual coefficient may be a negative value.

The decoding apparatus derives a current residual coefficient based on the sign flag (S1030). The decoding apparatus may derive a size (i.e., a level value) of the current residual coefficient based on residual information (e.g., size-related information on the current residual coefficient), and may derive the current residual coefficient in the current sub-block by using the size of the current residual coefficient and a sign of the current residual coefficient derived based on the sign flag. A sign flag, the decoding apparatus may derive a current residual coefficient in the current sub-block based on residual information (e.g., syntax elements of the current residual coefficient) and the sign flag of the current residual coefficient.

The decoding apparatus derives residual samples based on the current residual coefficients (S1040).

The decoding device may derive residual samples for the current block based on the current residual coefficients. That is, the decoding apparatus may derive residual samples in the current sub-block of the current block based on the current residual coefficients. For example, if it is derived that a transform is not applied to the current block based on the transform skip flag, that is, if the value of the transform skip flag is 1, the decoding apparatus may derive the current residual coefficients as residual samples of the current block. Alternatively, for example, if it is derived that a transform is not applied to the current block based on the transform skip flag, that is, if the value of the transform skip flag is 1, the decoding apparatus may derive residual samples of the current block by dequantizing the current residual coefficients. Alternatively, if the transform applied to the current block is derived based on the transform skip flag, that is, if the value of the transform skip flag is 0, the decoding apparatus may derive residual samples of the current block by inverse-transforming the current residual coefficients. Alternatively, for example, if the transform applied to the current block is derived based on the transform skip flag, that is, if the value of the transform skip flag is 0, the decoding apparatus may derive the residual samples by dequantizing the current residual coefficients and by inverse-transforming the dequantized coefficients.

The decoding apparatus generates a reconstructed picture based on the residual samples (S1050).

For example, the decoding apparatus may derive prediction samples by performing an inter prediction mode or an intra prediction mode on the current block based on prediction information received through a bitstream, and may generate a reconstructed picture by adding the prediction samples and residual samples. In addition, for example, the prediction information may include information indicating an intra prediction mode of the current block. The decoding apparatus may derive an intra prediction mode of the current block based on the information indicating the intra prediction mode, and may derive prediction samples of the current block based on the intra prediction mode of the current block and the reference samples. The reference samples may include an upper reference sample and a left reference sample of the current block. For example, if the size of the current block is NxN and the x-and y-components of the upper-left sample position of the current block are 0, the left reference sample may be p [ -1] [0] to p [ -1] [2N-1], and the upper reference sample may be p [0] [ -1] to p [2N-1] [ -1 ].

Thereafter, optionally, a loop filtering process such as a deblocking filtering, SAO, and/or ALF process may be applied to the reconstructed picture as described above in order to improve subjective/objective picture quality.

Fig. 11 briefly illustrates a decoding apparatus for performing an image decoding method according to the present disclosure. The method disclosed in fig. 10 may be performed by the decoding apparatus disclosed in fig. 11. Specifically, for example, the entropy decoder of the decoding apparatus of fig. 11 may perform S1000 to S1030 of fig. 10, the residual processor of the decoding apparatus of fig. 11 may perform S1040 of fig. 10, and the adder of the decoding apparatus of fig. 11 may perform S1050 of fig. 10. In addition, although not shown, the process of deriving the prediction samples may be performed by a predictor of the decoding apparatus of fig. 11.

According to the foregoing disclosure, the efficiency of residual coding can be improved.

In addition, according to the present disclosure, it is possible to code a sign flag indicating a sign of a residual coefficient based on a context model, thereby saving a bit amount of the sign flag assigned to the residual coefficient and improving overall residual coding efficiency.

In addition, according to the present disclosure, a context model indicating a sign flag of a sign of a residual coefficient is derived based on the sign flag of the residual coefficient coded before the residual coefficient, and thus the sign flag is coded by considering correlation between adjacent residual coefficients, thereby saving the amount of bits assigned to the sign flag and improving overall residual coding efficiency.

In the above embodiments, the method is described based on a flowchart having a series of steps or blocks. The present disclosure is not limited to the order of the above steps or blocks. Some steps or blocks may be performed in a different order or concurrently with other steps or blocks from that described above. Further, those skilled in the art will appreciate that the steps shown in the flowcharts are not exclusive and may include other steps as well, or one or more steps in the flowcharts may be deleted without affecting the scope of the present disclosure.

The embodiments described in this specification may be performed by being implemented on a processor, a microprocessor, a controller, or a chip. For example, the functional elements shown in each figure may be performed by being implemented on a computer, processor, microprocessor, controller, or chip. In this case, information for implementation (e.g., information about instructions) or algorithms may be stored in the digital storage medium.

In addition, a decoding apparatus and an encoding apparatus to which the present disclosure is applied may be included in: multimedia broadcast transmitting/receiving devices, mobile communication terminals, home theater video devices, digital theater video devices, surveillance cameras, video chat devices, real-time communication devices such as video communication, mobile streaming devices, storage media, camcorders, VoD service providing devices, over-the-top (OTT) video devices, internet streaming service providing devices, three-dimensional (3D) video devices, teleconference video devices, transportation user devices (e.g., vehicle user devices, airplane user devices, and ship user devices), and medical video apparatuses; and the decoding apparatus and the encoding apparatus to which the present disclosure is applied may be used to process a video signal or a data signal. For example, an over-the-top (OTT) video device may include a game console, a blu-ray player, an internet access television, a home theater system, a smart phone, a tablet, a Digital Video Recorder (DVR), and so forth.

In addition, the processing method to which the present disclosure is applied may be generated in the form of a program executed by a computer, and may be stored in a computer-readable recording medium. The multimedia data having the data structure according to the present disclosure may also be stored in a computer-readable recording medium. The computer-readable recording medium includes all types of storage devices in which computer-readable data is stored. The computer-readable recording medium may include, for example, BD, Universal Serial Bus (USB), ROM, PROM, EPROM, EEPROM, RAM, CD-ROM, magnetic tape, floppy disk, and optical data storage device. In addition, the computer-readable recording medium includes media implemented in the form of carrier waves (e.g., transmission via the internet). In addition, the bitstream generated by the encoding method may be stored in a computer-readable recording medium or transmitted through a wired/wireless communication network.

In addition, embodiments of the present disclosure may be implemented with a computer program product according to program codes, and the program codes may be executed in a computer by the embodiments of the present disclosure. The program code may be stored on a computer readable carrier.

Fig. 12 illustrates a structure diagram of a content streaming system to which the present disclosure is applied.

A content streaming system to which embodiments of the present document are applied may mainly include an encoding server, a streaming server, a web server, a media storage, a user device, and a multimedia input device.

The encoding server compresses content input from a multimedia input device such as a smart phone, a camera, or a camcorder into digital data to generate a bitstream and transmits the bitstream to the streaming server. As another example, when a multimedia input device such as a smartphone, a camera, or a camcorder directly generates a bitstream, the encoding server may be omitted.

The bitstream may be generated by applying the encoding method or the bitstream generation method of the embodiments of this document, and the streaming server may temporarily store the bitstream in the course of transmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user device through the web server based on a user request, and the web server serves as an intermediary for notifying the user of the service. When a user requests a desired service from the web server, the web server delivers the request to the streaming server, and the streaming server transmits multimedia data to the user. In this case, the content streaming system may include a separate control server. In this case, the control server serves to control commands/responses between devices within the content streaming system.

The streaming server may receive content from the media store and/or the encoding server. For example, when receiving content from an encoding server, the content may be received in real time. In this case, in order to provide a smooth streaming service, the streaming server may store the bit stream for a predetermined period of time.

Examples of user devices may include mobile phones, smart phones, laptop computers, digital broadcast terminals, Personal Digital Assistants (PDAs), Portable Multimedia Players (PMPs), navigators, touch screen PCs, tablet PCs, ultrabooks, wearable devices (e.g., smart watches, smart glasses, and head-mounted displays), digital TVs, desktop computers, digital signage, and the like. Each server within the content streaming system may operate as a distributed server, in which case the data received from each server may be distributed.

78页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:编码和解码图像

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类