Image decoding method using context-coded sign flag in image coding system and apparatus therefor

By deriving and coding a context model for the signature flag of a registered dual coefficient based on previously coded peripheral residual dual coefficients, the method enhances video coding efficiency and reduces bit allocation for signature flags in high-resolution video data.

JP2025061761APending Publication Date: 2025-04-11LG ELECTRONICS INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2025009781
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2019-03-04
Filing Date
2025-01-23
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The increasing demand for high-resolution and high-quality video data poses a challenge for efficient video coding, leading to higher transmission and storage costs.

Method used

A method and apparatus for deriving and coding a context model of a signature flag representing the sign of a registered dual coefficient, based on the signature flag of a previously coded peripheral residual dual coefficient, to improve video coding efficiency.

Benefits of technology

The proposed solution increases the efficiency of residual coding by reducing the number of bits assigned to the signature flag, thereby improving overall residual coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025061761000001_ABST
    Figure 2025061761000001_ABST
Patent Text Reader

Abstract

To provide an image decoding method performed by a decoding device.SOLUTION: An image decoding method performed by a decoding device according to the present document comprises the steps of: deriving a context model for a sign flag of a current residual coefficient of a current block; and decoding the sign flag on the basis of the context model, wherein the context model for the sign flag is derived on the basis of a sign flag of a residual coefficient decoded before the current residual coefficient in the current block.SELECTED DRAWING: Figure 10
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This document relates to a video coding technology, and more particularly to a video decoding method and apparatus for deriving a context model of a sign flag representing the sign of a current residual coefficient based on a sign flag of a previously coded residual coefficient in a video coding system, and coding the sign flag based on the derived context model. [Background technology]

[0002] Recently, the demand for high-resolution, high-quality images such as HD (High Definition) images and UHD (Ultra High Definition) images is increasing in various fields. As the resolution and quality of image data increases, the amount of information or bits to be transmitted increases relatively compared to existing image data, so that when the image data is transmitted using a medium such as an existing wired or wireless broadband line or when the image data is stored using an existing storage medium, the transmission cost and storage cost increase.

[0003] Therefore, in order to effectively transmit, store and play back high-resolution, high-quality video information, a highly efficient video compression technique is required. Summary of the Invention [Problem to be solved by the invention]

[0004] The technical problem of this document is to provide a method and apparatus for increasing video coding efficiency.

[0005] Another technical problem of this document is to provide a method and apparatus for improving the efficiency of residual coding.

[0006] Another technical objective of this document is to provide a method and apparatus for deriving and coding a context model of a sign flag representing the sign of a residual coefficient based on the sign flags of previously coded neighboring residual coefficients of the residual coefficient when coding residual information. [Means for solving the problem]

[0007] According to an embodiment of the present document, there is provided a video decoding method performed by a decoding device, the method including the steps of: deriving a context model for a sign flag of a current residual coefficient of a current block; and decoding the sign flag based on the context model, the context model for the sign flag being derived based on a sign flag of a residual coefficient previously decoded before the current residual coefficient in the block.

[0008] According to another embodiment of the present document, there is provided a decoding device for decoding an image, comprising: an entropy decoding unit for deriving a context model for a sign flag of a current residual coefficient of a current block, and decoding the sign flag based on the context model, 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 block.

[0009] According to another embodiment of the present document, there is provided a video encoding method performed by an encoding apparatus, the method including the steps of deriving a current residual coefficient of a current block, deriving a context model for a sign flag of the current residual coefficient, and encoding the sign flag based on the context model, wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient previously decoded of the current residual coefficient in the block.

[0010] According to another embodiment of the present document, there is provided a video encoding apparatus, comprising an entropy encoding unit configured to derive a context model for a sign flag of a current residual coefficient and encode the sign flag based on the context model, wherein the context model for the sign flag is derived based on a sign flag of a previously decoded residual coefficient of the current residual coefficient in the current block. Effect of the Invention

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

[0012] According to this document, a sign flag representing the sign of a residual coefficient is coded based on a context model, thereby saving the amount of bits allocated to the sign flag for the residual coefficient and improving the overall residual coding efficiency.

[0013] According to this document, a context model for a sign flag representing the sign of a residual coefficient is derived based on the signs of surrounding residual coefficients adjacent to the residual coefficient, thereby coding the sign flag taking into account the correlation between adjacent residual coefficients, thereby saving the amount of bits allocated to the sign flag and improving the overall residual coding efficiency.

[0014] According to this document, a context model for a sign flag representing the sign of a residual coefficient is derived based on the signs of previously decoded surrounding residual coefficients of the residual coefficient, thereby coding the sign flag taking into account the correlation between adjacent residual coefficients, thereby saving the amount of bits allocated to the sign flag and improving overall residual coding efficiency. [Brief description of the drawings]

[0015] [Figure 1] 1 illustrates generally an example of a video / image coding system in which embodiments of the present document can be applied; [Diagram 2] FIG. 1 is a diagram illustrating the configuration of a video / image encoding device to which an embodiment of the present document can be applied. [Diagram 3] 1 is a diagram illustrating the configuration of a video / image decoding device to which an embodiment of the present document can be applied. [Figure 4] Illustratively, CABAC (context-adaptive binary arithmetic coding) is used to encode syntax elements. [Diagram 5] A figure illustrating examples of transform coefficients etc. in a 4x4 block. [Figure 6] An example of determining a context model for a sign flag of a current residual coefficient according to the present embodiment will be described below. [Figure 7] An encoding apparatus and a decoding apparatus are illustratively shown for coding a sign flag of a current residual coefficient based on whether a transform is applied to the current block and on the sign of a previously coded residual coefficient. [Figure 8] 1 illustrates a schematic diagram of a video encoding method according to an encoding device according to the present document. [Figure 9] 1 illustrates a schematic diagram of an encoding device for performing a video encoding method according to the present document. [Figure 10] 1 illustrates an outline of a video decoding method by a decoding device according to the present document. [Figure 11] 1 illustrates a schematic diagram of a decoding device for performing a video decoding method according to the present document. [Figure 12] 1 exemplarily illustrates a structural diagram of a content streaming system to which an embodiment of the present document is applied. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0016] This document may have various modifications and may have various embodiments, and a specific embodiment will be illustrated in the drawings and described in detail. However, this is not intended to limit this document to a specific embodiment. Commonly used terms in this specification are used merely to describe a specific embodiment, and are not intended to limit the technical ideas of this document. A singular expression includes a plural expression unless the context clearly indicates otherwise. In this specification, terms such as "include" or "have" are intended to specify the presence of features, numbers, steps, operations, components, parts, or combinations thereof described in the specification, and should be understood not to preclude the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof.

[0017] Meanwhile, each component in the drawings described in this document is illustrated independently for the convenience of explaining the different characteristic functions, and does not mean that each component is realized by separate hardware or software. For example, two or more components among the components may be combined to form one component, and one component may be divided into multiple components. An embodiment in which each component is integrated and / or separated is also included in the scope of the rights of this document as long as it does not deviate from the essence of this document.

[0018] Hereinafter, preferred embodiments of the present invention will be described in more detail with reference to the accompanying drawings. Hereinafter, the same reference numerals will be used for the same components in the drawings, and duplicated descriptions of the same components may be omitted.

[0019] FIG. 1 illustrates generally an example of a video / image coding system in which embodiments of the present document can be applied.

[0020] As shown in Figure 1, the video / image coding system may include a first device (source device) and a second device (receiving device). The source device may transmit encoded video / image information or data to the receiving device in a file or streaming form via a digital storage medium or a network.

[0021] The source device may comprise a video source, an encoding device, and a sending unit. The receiving device may comprise a receiving unit, a decoding device, and a renderer. The encoding device may be referred to as a video / video encoding device, and the decoding device may be referred to as a video / video decoding device. The transmitter may be included in the encoding device. The receiver may be included in the decoding device. The renderer may comprise a display unit, which may be a separate device or an external component.

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

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

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

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

[0026] The renderer may render the decoded video / image, and the rendered video / image may be displayed via a display unit.

[0027] This document relates to video / image coding. For example, the methods / embodiments disclosed in this document can be applied to methods disclosed in the versatile video coding (VVC) standard, the essential video coding (EVC) standard, the AOMedia Video 1 (AV1) standard, the 2nd generation of audio video coding standard (AVS2), or the next generation video / image coding standard (e.g., H.267 or H.268, etc.).

[0028] This document presents various embodiments related to video / image coding, which may also be implemented in combination with one another, unless otherwise stated.

[0029] In this document, video may mean a collection of a series of images over time. A picture generally means a unit showing one image at a specific time, and a subpicture / slice / tile is a unit constituting a part of a picture in coding. A subpicture / slice / tile may include one or more coding tree units (CTUs). A picture may consist of one or more subpictures / slices / tiles. A picture may consist of one or more groups of tiles. A tile group may include one or more tiles. A brick may represent a rectangular region of CTU rows within a tile in a picture. A tile may be partitioned into multiple bricks, each of which consisting of one or more CTU rows within the tile. A tile that is not partitioned into multiple bricks may also be referred to as a brick.A brick scan is a specific sequential ordering of CTUs partitioning a picture in which the CTUs are ordered consecutively in CTU raster scan in a brick, bricks within a tile are ordered consecutively in a raster scan of the bricks of the tile, and tiles in a picture are ordered consecutively in a raster scan of the tiles of the picture. Additionally, a subpicture may represent a rectangular region of one or more slices within a picture. That is, a subpicture contains one or more slices that collectively cover a rectangular region of a picture. A tile is a rectangular region of CTUs within a particular tile column and a particular tile row in a picture.The tile column is a rectangular region of CTUs having a height equal to the height of the picture and a width specified by syntax elements in the picture parameter set. The tile row is a rectangular region of CTUs having a height specified by syntax elements in the picture parameter set and a width equal to the width of the picture. A tile scan is a specific sequential ordering of CTUs partitioning a picture in which the CTUs are ordered consecutively in CTU raster scan in a tile whereas tiles in a picture are ordered consecutively in a raster scan of the tiles of the picture.A slice includes an integer number of bricks of a picture that maybe exclusively contained in a single NAL unit. A slice may consist of either a number of complete tiles or only a consecutive sequence of complete bricks of one tile. In this document, the terms tile group and slice may be used interchangeably. For example, tile group / tile group header may be referred to as slice / slice header in this document.

[0030] A pixel or a pel may refer to the smallest unit that constitutes one picture (or image). Also, a term corresponding to a pixel may be used as a "sample." A sample may generally indicate a pixel or a pixel value, may indicate only a pixel / pixel value of a luma component, or may indicate only a pixel / pixel value of a chroma component.

[0031] A unit may indicate a basic unit of image processing. A unit may include at least one of a specific region of a picture and information related to the region. One unit may include one luma block and two chroma (e.g., cb, cr) blocks. A unit may be used interchangeably with terms such as block or area depending on the case. In a general case, an M×N block may include samples (or sample arrays) consisting of M columns and N rows, or a set (or array) of transform coefficients.

[0032] In this specification, "A or B" may mean "A only," "B only," or "both A and B." In other words, in this specification, "A or B" may be interpreted as "A and / or B." For example, in this specification, "A, B or C" may mean "A only," "B only," "C only," or "any combination of A, B and C."

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

[0034] In this specification, "at least one of A and B" may mean "A only," "B only," or "both A and B." In addition, in this specification, the expressions "at least one of A or B" and "at least one of A and / or B" may be interpreted similarly to "at least one of A and B."

[0035] In addition, in this specification, "at least one of A, B and C" may mean "A only," "B only," "C only," or "any combination of A, B and C." Furthermore, "at least one of A, B or C" and "at least one of A, B and / or C" may mean "at least one of A, B and C."

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

[0037] Technical features described separately in one drawing in this specification may be realized separately or simultaneously.

[0038] The following drawings are created to explain a specific example of the present specification. The names of specific devices and names of specific signals / messages / fields described in the drawings are presented for illustrative purposes only, and the technical features of the present specification are not limited to the specific names used in the following drawings.

[0039] 2 is a diagram for illustrating a schematic configuration of a video / image encoding device to which an embodiment of the present document can be applied. Hereinafter, the term "video encoding device" may include a video encoding device.

[0040] As shown in FIG. 2, the encoding apparatus 200 may be configured to include an image partitioner 210, a predictor 220, a residual processor 230, an entropy encoder 240, an adder 250, a filter 260, and a memory 270. The predictor 220 may include an inter 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 residual processor 230 may further include a subtractor 231. The adder 250 may be referred to as a reconstructor or a reconstructed block generator. The image division unit 210, the prediction unit 220, the residual processing unit 230, the entropy encoding unit 240, the addition unit 250, and the filtering unit 260 may be configured with one or more hardware components (e.g., an encoder chipset or a processor) according to an embodiment. Also, the memory 270 may include a decoded picture buffer (DPB) and may be configured with a digital storage medium. The hardware components may further include the memory 270 as an internal / external component.

[0041] The image division unit 210 may divide an input image (or picture, frame) input to the encoding device 200 into one or more processing units. As an example, the processing units may be called coding units (CUs). In this case, the coding units may be recursively divided from a coding tree unit (CTU) or a largest coding unit (LCU) according to a quad-tree binary-tree ternary-tree (QTBTTT) structure. For example, one coding unit may be divided into a plurality of coding units of a deeper depth based on a quad-tree structure, a binary tree structure, and / or a ternary structure. In this case, for example, a quad-tree structure may be applied first, and a binary tree structure and / or a ternary structure may be applied later. Alternatively, a binary tree structure may be applied first. A coding procedure according to this document may be performed based on a final coding unit that is not further divided. In this case, the largest coding unit may be used as the final coding unit immediately based on coding efficiency according to image characteristics, or the coding unit may be recursively divided into coding units of lower depths as necessary, and a coding unit of an optimal size may be used as the final coding unit. Here, the coding procedure may include procedures such as prediction, transformation, and restoration, which will be described later. As another example, the processing unit may further include a prediction unit (PU) or a transform unit (TU). In this case, the prediction unit and the transform unit may be divided or partitioned from the final coding unit described above, respectively.The prediction unit is a unit of sample prediction, and the transform unit is a unit for deriving transform coefficients and / or a unit for deriving a residual signal from the transform coefficients.

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

[0043] The encoding apparatus 200 may generate a residual signal (residual block, residual sample array) by subtracting a prediction signal (predicted block, prediction sample array) output from the inter prediction unit 221 or the intra prediction unit 222 from an input video signal (original block, original sample array), and the generated residual signal is transmitted to the conversion unit 232. In this case, as illustrated, a unit that subtracts a prediction signal (prediction block, prediction sample array) from an input video signal (original block, original sample array) in the encoder 200 may be called a subtraction unit 231. The prediction unit may perform prediction on a processing target block (hereinafter, referred to as a current block) and generate a predicted block including a prediction sample for the current block. The prediction unit may determine whether intra prediction or inter prediction is applied in units of the current block or CU. The prediction unit may generate various information related to prediction, such as prediction mode information, and transmit the information to the entropy encoding unit 240, as will be described later in the description of each prediction mode. The prediction information can be encoded by the entropy encoding unit 240 and output in the form of a bitstream.

[0044] The intra prediction unit 222 may predict the current block by referring to samples in the current picture. The referenced samples may be located in the neighborhood of the current block or may be located away from the current block depending on the prediction mode. In the intra prediction, the prediction mode 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. The directional mode may include, for example, 33 directional prediction modes or 65 directional prediction modes depending on the fineness of the prediction direction. However, this is merely an example, and more or less directional prediction modes may be used depending on the setting. The intra prediction unit 222 may also determine the prediction mode applied to the current block using the prediction mode applied to the neighboring block.

[0045] The inter prediction unit 221 may derive a predicted block for a current block based on a reference block (reference sample array) identified 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 a neighboring block and the current block. The motion information may include a motion vector and a reference picture index. The motion information may further include inter prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter prediction, the neighboring block may include a spatial neighboring block present in the current picture and a temporal neighboring block present in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same or different. The temporal neighboring block may be called a collocated reference block, a collocated CU (colCU), etc., and the reference picture including the temporal neighboring block may be called a collocated picture (colPic). For example, the inter prediction unit 221 may generate information indicating which candidate is used to derive a motion vector and / or a reference picture index of the current block by forming a motion information candidate list based on neighboring blocks. Inter prediction may be performed based on various prediction modes, and for example, in the case of a skip mode and a merge mode, the inter prediction unit 221 may use motion information of a neighboring block as motion information of the current block. In the case of the skip mode, unlike the merge mode, a residual signal may not be transmitted.In the case of a motion vector prediction (MVP) mode, the motion vector of a neighboring block can be used as a motion vector predictor, and the motion vector of the current block can be indicated by signaling the motion vector difference.

[0046] The prediction unit 220 may generate a prediction signal based on various prediction methods described later. For example, the prediction unit may apply intra prediction or inter prediction for prediction of one block, and may simultaneously apply intra prediction and inter prediction. This may be called combined inter and intra prediction (CIIP). In addition, the prediction unit may be based on an intra block copy (IBC) prediction mode or a palette mode for prediction of a block. The IBC prediction mode or palette mode may be used for content image / moving image coding such as games, for example, as in screen content coding (SCC). IBC basically performs prediction within a current picture, but may be performed similarly to inter prediction in deriving a reference block within 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 seen as an example of intra coding or intra prediction. When the palette mode is applied, a sample value within a picture may be signaled based on information regarding a palette table and a palette index.

[0047] The prediction signal generated through the prediction unit (including the inter prediction unit 221 and / or the intra prediction unit 222) may be used to generate a restored signal or may be used to generate a residual signal. The transform unit 232 may generate transform coefficients by applying a transform technique to the residual signal. For example, the transform technique may include at least one of a discrete cosine transform (DCT), a discrete sine transform (DST), a Karhunen-Loeve transform (KLT), a graph-based transform (GBT), or a conditionally non-linear transform (CNT). Here, the GBT refers to a transform obtained from a graph when the relationship information between pixels is expressed as a graph. The CNT refers to a transform obtained based on a prediction signal generated using all previously reconstructed pixels. In addition, the transform process may be applied to pixel blocks having the same square size, or may be applied to non-square, variable-sized blocks.

[0048] The quantizer 233 quantizes the transform coefficients and transmits the quantized transform coefficients to the entropy encoding unit 240, which may encode the quantized signal (information on the quantized transform coefficients) and output the quantized signal as a bitstream. The information on the quantized transform coefficients may be referred to as residual information. The quantizer 233 may rearrange the quantized transform coefficients in a block form into a one-dimensional vector form based on a coefficient scan order, and may generate information on the quantized transform coefficients based on the quantized transform coefficients in the one-dimensional vector form. The entropy encoding unit 240 may perform various encoding methods, such as exponential Golomb, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC). The entropy encoding unit 240 may encode information required for video / image restoration (e.g., values ​​of syntax elements, etc.) together with or separately from the quantized transform coefficients. The encoded information (e.g., encoded video / picture information) may be transmitted or stored in the form of a bitstream in network abstraction layer (NAL) unit units. The video / picture information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). The video / picture information may further include general constraint information. Information and / or syntax elements transmitted / signaled from an encoding device to a decoding device in this document may be included in the video / picture information.The video / image information may be encoded through the above-mentioned encoding procedure and included in the bitstream. The bitstream may be transmitted via a network or stored in a digital storage medium. Here, the network may include a broadcasting 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, etc. A transmitter (not shown) for transmitting the signal output from the entropy encoding unit 240 and / or a storage unit (not shown) for storing the signal may be configured as an internal / external element of the encoding apparatus 200, or the transmitter may be included in the entropy encoding unit 240.

[0049] 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 restored by applying inverse quantization and inverse transform to the quantized transform coefficients via the inverse quantizer 234 and the inverse transformer 235. The adder 250 may generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the reconstructed residual signal to the prediction signal output from the inter prediction unit 221 or the intra prediction unit 222. When there is no residual for the current block, such as when a skip mode is applied, a predicted block may be used as a reconstructed block. The adder 250 may be referred to as a reconstruction unit or a reconstructed block generator. The generated reconstructed signal may be used for intra prediction of the next current block in the current picture, and may also be used for inter prediction of the next picture after filtering, as described below.

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

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

[0052] 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 through this, the encoding apparatus may avoid prediction mismatch between the encoding apparatus 200 and the decoding apparatus 300, and may also improve encoding efficiency.

[0053] The memory 270DPB may store the modified reconstructed picture for use as a reference picture in the inter prediction unit 221. The memory 270 may store motion information of a block from which motion information in the current picture is derived (or encoded) and / or motion information of a block in an already reconstructed picture. The stored motion information may be transmitted to the inter prediction unit 221 to be 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 transmit them to the intra prediction unit 222.

[0054] FIG. 3 is a diagram illustrating a schematic configuration of a video / image decoding device to which an embodiment of this document can be applied.

[0055] As shown in FIG. 3, the decoding device 300 may be configured to 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 331 and an intra predictor 332. The residual processor 320 may include a dequantizer 321 and an inverse transformer 322. The entropy decoding unit 310, the residual processor 320, the predictor 330, the adder 340, and the filter 350 may be configured as one hardware component (e.g., a decoder chipset or processor) according to an embodiment. Also, the memory 360 may include a decoded picture buffer (DPB) and may be configured as a digital storage medium. The hardware components may further include a memory 360 as an internal / external component.

[0056] When a bitstream including video / image information is input, the decoding apparatus 300 can restore an image corresponding to a process in which the video / image information is processed by the encoding apparatus of FIG. 2. For example, the decoding apparatus 300 can derive a unit / block based on block division related information obtained from the bitstream. The decoding apparatus 300 can perform decoding using a processing unit applied in the encoding apparatus. Thus, the processing unit for decoding is, for example, a coding unit, and the coding unit can be divided from a coding tree unit or a maximal coding unit according to a quad tree structure, a binary tree structure, and / or a ternary tree structure. One or more transform units can be derived from the coding unit. Then, the restored image signal decoded and output by the decoding apparatus 300 can be reproduced by a reproduction device.

[0057] The decoding apparatus 300 may receive a signal output from the encoding apparatus of FIG. 2 in the form of a bitstream, and the received signal may be decoded via the entropy decoding unit 310. For example, the entropy decoding unit 310 may derive information (e.g., video / image information) required for image restoration (or picture restoration) by parsing the bitstream. The video / image information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information may further include general constraint information. The decoding apparatus may further decode pictures based on information on the parameter set and / or the general constraint information. Signaling / received information and / or syntax elements described later in this document may be obtained from the bitstream by being decoded via the decoding procedure. For example, the entropy decoding unit 310 may decode information in a bitstream based on a coding method such as exponential Golomb coding, CAVLC, or CABAC, and output values ​​of syntax elements required for image restoration, quantized values ​​of transform coefficients related to residuals, etc. More specifically, the CABAC entropy decoding method may receive bins corresponding to each syntax element in a bitstream, determine a context model using information on a syntax element to be decoded and decoding information on adjacent and to-be-decoded blocks, or information on symbols / bins decoded in a previous step, predict a probability of occurrence of a bin according to the determined context model, and perform arithmetic decoding of the bins to generate a symbol corresponding to the value of each syntax element.In this case, the CABAC entropy decoding method may update the context model using information of the decoded symbol / bin for the context model of the next symbol / bin after determining the context model. Prediction information from the information decoded by the entropy decoding unit 310 is provided to a prediction unit (inter prediction unit 332 and intra prediction unit 331), and residual values ​​entropy-decoded by the entropy decoding unit 310, i.e., quantized transform coefficients and related parameter information, may be input to the residual processing unit 320. The residual processing unit 320 may derive a residual signal (residual block, residual sample, residual sample array). In addition, filtering information from the information decoded by the entropy decoding unit 310 may be provided to the filtering unit 350. Meanwhile, a receiving unit (not shown) for receiving a signal output from the encoding device may be further configured as an internal / external element of the decoding device 300, or the receiving unit is a component of the entropy decoding unit 310. Meanwhile, the decoding device according to this document may be called a video / image / picture decoding device, and the decoding device may be divided 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 decoding unit 310, and the sample decoder may include at least one of the inverse quantization unit 321, the inverse transform unit 322, the addition unit 340, the filtering unit 350, the memory 360, the inter prediction unit 332, and the intra prediction unit 331.

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

[0059] The inverse transform unit 322 inversely transforms the transform coefficients to obtain a residual signal (residual block, residual sample array).

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

[0061] The prediction unit 320 may generate a prediction signal based on various prediction methods described later. For example, the prediction unit may apply intra prediction or inter prediction for prediction of one block, and may simultaneously apply intra prediction and inter prediction. This may be called combined inter and intra prediction (CIIP). In addition, the prediction unit may be based on an intra block copy (IBC) prediction mode or a palette mode for prediction of a block. The IBC prediction mode or palette mode may be used for content image / moving image coding such as games, for example, as in screen content coding (SCC). IBC basically performs prediction within a current picture, but may be performed similarly to inter prediction in deriving a reference block within 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 seen as an example of intra coding or intra prediction. When the palette mode is applied, information regarding a palette table and a palette index may be included in the video / image information and signaled.

[0062] The intra prediction unit 331 may predict a current block by referring to samples in a current picture. The referenced samples may be located in the neighborhood of the current block or may be located far away depending on a prediction mode. In intra prediction, prediction modes may include a plurality of non-directional modes and a plurality of directional modes. The intra prediction unit 331 may also determine a prediction mode to be applied to the current block using a prediction mode applied to a neighboring block.

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

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

[0065] The adder 340 may be referred to as a reconstruction unit or a reconstruction block generator. The generated reconstruction signal may be used for intra prediction of a next block to be processed in a current picture, and may be output after filtering as described below, or may be used for inter prediction of a next picture.

[0066] Meanwhile, luma mapping with chroma scaling (LMCS) can be applied during the picture decoding process.

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

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

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

[0070] As described above, the encoding device can perform various encoding methods such as exponential Golomb, CAVLC (context-adaptive variable length coding), CABAC (context-adaptive binary arithmetic coding), etc. Also, the decoding device can decode information in a bitstream based on a coding method such as exponential Golomb coding, CAVLC, or CABAC, and output values ​​of syntax elements required for image restoration, quantized values ​​of transform coefficients related to residuals, etc.

[0071] For example, the above coding method can be performed as described below.

[0072] FIG. 4 illustrates an example of CABAC (context-adaptive binary arithmetic coding) for encoding a syntax element. For example, in the CABAC encoding process, if an input signal is a syntax element that is not a binary value, an encoding device may binarize the value of the input signal to convert the input signal into a binary value. Also, if the input signal is already a binary value (i.e., the value of the input signal is a binary value), binarization may be bypassed. Here, each binary digit 0 or 1 constituting a binary value may be referred to as a bin. For example, if the binary string after binarization is 110, each of 1, 1, and 0 may be referred to as one bin. The bin (etc.) for one syntax element may represent the value of the syntax element.

[0073] The binarized bins of the syntax elements may then be input to a regular encoding engine or a bypass encoding engine. The regular encoding engine of the encoding device may assign a context model reflecting a probability value to the bin and encode the bin based on the assigned context model. The regular encoding engine of the encoding device may update the context model for each bin after encoding the bin. The bins encoded as described above may be referred to as context-coded bins.

[0074] Meanwhile, when the binarized bins of the syntax elements are input to the bypass encoding engine, they can be coded as follows. For example, the bypass encoding engine of the encoding device omits a procedure of estimating a probability for an input bin and a procedure of updating a probability model applied to the bin after encoding. When bypass encoding is applied, the encoding device can encode the input bin by applying a uniform probability distribution instead of assigning a context model, thereby improving the encoding speed. The bins encoded as described above can be referred to as bypass bins.

[0075] Entropy decoding can refer to a process in which the above-mentioned entropy encoding process is performed in reverse order.

[0076] For example, when a syntax element is decoded based on a context model, a decoding device can receive a bin corresponding to the syntax element through a bitstream, determine a context model using the syntax element and decoding information of a block to be decoded or a neighboring block, or information of a symbol / bin decoded in a previous step, predict an occurrence probability of the received bin according to the determined context model, and derive a value of the syntax element by performing arithmetic decoding of the bin. Then, the context model of the bin to be decoded next can be updated to the determined context model.

[0077] Also, for example, when a syntax element is bypass decoded, a decoding device may receive a bin corresponding to the syntax element through a bitstream and decode the input bin by applying a uniform probability distribution. In this case, the decoding device may omit a procedure of deriving a context model of the syntax element and a procedure of updating the context model applied to the bin after decoding.

[0078] As described above, the residual samples may be derived into 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 a block may be signaled in the form of residual information. The residual information may include a residual coding syntax. That is, an encoding device may construct a residual coding syntax as residual information, encode the residual coding syntax, and output the resulting bitstream, and a decoding device may decode the residual coding syntax from the bitstream to derive residual (quantized) transform coefficients. The residual coding syntax may include syntax elements indicating whether a transform has been applied to the block, where the last valid transform coefficient in the block is located, whether a valid transform coefficient exists in a subblock, and what the magnitude / sign of the valid transform coefficient is, as described below.

[0079] For example, the (quantized) transform coefficients (i.e., the 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_gt3_flag, abs_remainder, coeff_sign_flag, dec_abs_level, mts_idx, etc. Syntax elements related to residual data encoding / decoding may be represented as follows:

[0080] [Table 1-1]

[0081] [Table 1-2]

[0082] [Table 1-3]

[0083] [Table 1-4]

[0084] Transform_skip_flag indicates whether or not transform is skipped for an associated block. The transform_skip_flag may be a syntax element of a transform skip flag. The associated block may be a coding block (CB) or a transform block (TB). With respect to the transform (and quantization) and residual coding procedures, CB and TB may be used interchangeably. For example, as described above, residual samples may be derived for a CB, and (quantized) transform coefficients may be derived through transform and quantization for the residual samples. Through the residual coding procedure, information (e.g., syntax elements, etc.) efficiently indicating the position, magnitude, code, etc. of the (quantized) transform coefficients may be generated and signaled. The quantized transform coefficients may be simply referred to as transform coefficients, etc. In general, if the CB is not larger than the maximum TB, the size of the CB may be the same as the size of the TB, and in this case, the target block to be transformed (and quantized) and residual coded may be referred to as a CB or a TB. On the other hand, if CB is greater than the maximum TB, the target block to be transformed (and quantized) and residually coded may be called TB. Hereinafter, it will be described that syntax elements related to residual coding are signaled in units of transform blocks TB, but this is merely an example, and as described above, the TB may be used interchangeably with the coding block CB.

[0085] On the other hand, the syntax elements etc. signaled after the conversion skip flag is signaled may be the same as the syntax elements etc. disclosed in Table 6 described below, and a specific explanation of the syntax elements etc. is as described below.

[0086] Meanwhile, unlike the embodiment of transmitting the above-mentioned syntax elements, a method of signaling tu_mts_idx may be proposed.

[0087] Specifically, a comparison between the method of signaling tu_mts_idx in the existing VVC Draft 3 and the proposed method of signaling tu_mts_idx can be made as follows.

[0088] [Table 2]

[0089] As shown in Table 2, according to the existing method, the MTS flag for the current block is parsed first, then the transform skip flag is parsed, and then the coding for the MTS index is performed. Here, the coding for the MTS index may be performed by fixed-length binarization, and the fixed bit length for the MTS index may be 2.

[0090] In contrast, according to the proposed method, the transform skip flag and the MTS flag are not parsed separately, and the MTS index may be coded, and truncated unary binarization may be used for coding the MTS index. Here, the MTS index may indicate whether a transform is applied to residual information of a current block, and may indicate whether the MTS is applied. That is, in the proposed method, a method may be proposed in which the transform skip flag, the MTS flag, and the MTS index are signaled as one syntax element. In the proposed method, the first bin of the MTS index may indicate whether a transform is applied to residual information of a current block, and the second bin of the MTS index may indicate whether the MTS is applied and the transform kernel to be applied.

[0091] In the proposed method, the meaning and binary value of the MTS index value may be as shown in the following table.

[0092] [Table 3]

[0093] For example, when the value of the MTS index is 0, the MTS index may represent that a transform is applied to the current block, MTS is not applied, and the horizontal transform kernel type and the vertical transform kernel type are DCT-2. When the value of the MTS index is 1, the MTS index may represent that a transform is not applied to the current block (i.e., MTS is not applied, and does not indicate a transform kernel type). When the value of the MTS index is 2, the MTS index may represent that a transform and MTS are applied to the current block, and the horizontal transform kernel type and the vertical transform kernel type are DST-7. When the value of the MTS index is 3, the MTS index may represent that a transform and MTS are applied to the current block, the horizontal transform kernel type is DCT-8, and the vertical transform kernel type is DST-7. When the value of the MTS index is 4, the MTS index may represent that a transform and MTS are applied to the current block, the horizontal transform kernel type is DST-7, and the vertical transform kernel type is DCT-8. Also, if the value of the MTS index is 5, the MTS index may indicate that a transform and MTS are applied to the current block, and that the horizontal transform kernel type and the vertical transform kernel type are DCT-8.

[0094] Alternatively, another example of the meaning and binary value represented by the MTS index value may be as shown in the following table.

[0095] [Table 4]

[0096] For example, if the value of the MTS index is 0, the MTS index may represent that a transform is not applied to the current block (i.e., no MTS is applied and no transform kernel type is indicated). If the value of the MTS index is 1, the MTS index may represent that a transform is applied to the current block, no MTS is applied, and the horizontal transform kernel type and the vertical transform kernel type are DCT-2. If the value of the MTS index is 2, the MTS index may represent that a transform and MTS are applied to the current block, and the horizontal transform kernel type and the vertical transform kernel type are DST-7. If the value of the MTS index is 3, the MTS index may represent that a transform and MTS are applied to the current block, the horizontal transform kernel type is DCT-8, and the vertical transform kernel type is DST-7. If the value of the MTS index is 4, the MTS index may represent that a transform and MTS are applied to the current block, the horizontal transform kernel type is DST-7, and the vertical transform kernel type is DCT-8. Also, if the value of the MTS index is 5, the MTS index may indicate that a transform and MTS are applied to the current block, and that the horizontal transform kernel type and the vertical transform kernel type are DCT-8.

[0097] Meanwhile, the number of context models may not be changed, and the method of specifying the context index increment ctxInc for each bin of the tu_mts_idx may be as shown in the following table.

[0098] [Table 5]

[0099] The proposed MTS index can also be referred to as a unified MTS index.

[0100] Syntax elements related to residual data encoding / decoding including the integrated MTS index can be represented as follows:

[0101] [Table 6-1]

[0102] [Table 6-2]

[0103] [Table 6-3]

[0104] [Table 6-4]

[0105] 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_gt1_flag, par_level_flag, abs_level_gt3_flag, abs_remainder, dec_abs_level, and / or coeff_sign_flag may be encoded / decoded.

[0106] In one embodiment, the encoding apparatus may encode (x, y) position information of the last non-zero transform coefficient in a 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, the last_sig_coeff_x_prefix represents a prefix of a column position of a last significant coefficient in a scanning order in a transform block, the last_sig_coeff_y_prefix represents a prefix of a row position of a last significant coefficient in the scanning order in the transform block, the last_sig_coeff_x_suffix represents a suffix of a column position of a last significant coefficient in the scanning order in the transform block, and the last_sig_coeff_y_suffix represents a suffix of a row position of a last significant coefficient in the scanning order in the transform block. Here, the significant coefficient may represent the non-zero coefficient. In addition, the scan order may be a top 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 current block (CB, or CB including TB) and / or a specific intra / inter prediction mode.

[0107] Next, the encoding device divides the transform block into 4x4 sub-blocks, etc., and then can use a 1-bit syntax element coded_sub_block_flag for each 4x4 sub-block to indicate whether or not there is a non-zero coefficient in the current sub-block.

[0108] If the value of coded_sub_block_flag is 0, there is no more information to transmit, and the encoding apparatus can end the encoding process for the current sub-block. Conversely, if the value of coded_sub_block_flag is 1, the encoding apparatus can continue the encoding process for sig_coeff_flag. Since the last sub-block containing a non-zero coefficient does not need to be coded for coded_sub_block_flag, and since the sub-block containing DC information of the transform block is highly likely to contain a non-zero coefficient, coded_sub_block_flag can be assumed to be 1 without being coded.

[0109] If the value of coded_sub_block_flag is 1 and it is determined that a non-zero coefficient exists in the current sub-block, the encoding apparatus may encode sig_coeff_flag having a binary value according to the reverse scanned order. The encoding apparatus may encode a 1-bit syntax element sig_coeff_flag for each transform coefficient according to the scan order. If the value of the transform coefficient at the current scan position is not 0, the value of sig_coeff_flag may be 1. Here, in the case of a sub-block including the last non-zero coefficient, since sig_coeff_flag does not need to be encoded for the last non-zero coefficient, the encoding process for the sub-block may be omitted. Level information encoding may be performed only when sig_coeff_flag is 1, and four syntax elements may be used in the level information encoding 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 one embodiment, the sig_coeff_flag may correspond to an example of a syntax element of a significant coefficient flag indicating whether the quantized transform coefficient is a significant coefficient other than zero.

[0110] The remaining level value after encoding for sig_coeff_flag may be derived as follows: That is, a syntax element remAbsLevel representing a level value to be encoded may be derived as follows: remAbsLevel=[sig_coeff_flag+remAbsLevel+remAbsLevel]=[sig_coeff_flag+remAbsLevel].

[0111]

number

[0112] Here, coeff means the actual transform coefficient value.

[0113] Furthermore, abs_level_gt1_flag may indicate whether remAbsLevel' at the scanning position n is greater than 1. For example, if the value of abs_level_gt1_flag is 0, the absolute value of the transform coefficient at the position may be 1. Furthermore, if the value of abs_level_gt1_flag is 1, the remAbsLevel representing the level value to be coded thereafter may be derived as shown in the following formula.

[0114]

number

[0115] In addition, the least significant coefficient (LSB) value of remAbsLevel described in the above Equation 2 can be encoded as shown in the following Equation 3 via par_level_flag.

[0116]

number

[0117] Here, "par_level_flag[n" can represent the parity of the transform coefficient level (value) at scanning position n.

[0118] The transform coefficient level value remAbsLevel to be encoded after par_level_flag encoding can be updated according to the following equation.

[0119]

number

[0120] abs_level_gt3_flag may indicate whether remAbsLevel at the corresponding scanning position n is greater than 3. Encoding for abs_remainder may be performed only if rem_abs_gt3_flag is 1. The relationship between the actual transform coefficient value coeff and each syntax element may be expressed as follows.

[0121]

number

[0122] The following table shows examples related to Equation 5 above.

[0123] [Table 7]

[0124] Here, |coeff| represents a transform coefficient level (value) and may be expressed as AbsLevel for the transform coefficient. Also, the sign of each coefficient may be encoded using coeff_sign_flag, which is a 1-bit symbol.

[0125] Meanwhile, as an example different from the embodiment of transmitting the above-mentioned syntax elements, etc., an embodiment may be proposed in which different residual coding schemes, i.e., different residual syntax elements, etc., are transmitted depending on whether a transform skip is applied for residual coding or not.

[0126] The syntax elements for the residual coding according to the above example can be expressed as in the following table.

[0127] [Table 8]

[0128]

Table 9-1

[0129]

Table 9-2

[0130]

Table 9-3

[0131]

Table 9-4

[0132]

Table 10-1

[0133]

Table 10-2

[0134]

Table 10-3

[0135] According to the present embodiment, as shown in Table 8, the residual coding may be branched 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 the residual coding depending on the value of the transform skip flag (depending on whether the transform skip is applied). The residual coding used when the transform skip is not applied (i.e., the transform is applied) may be called Regular Residual Coding (RRC), and the residual coding when the transform skip is not applied (i.e., the transform is not applied) may be called Transform Skip Residual Coding (TSRC). Table 9 may show syntax elements of the residual coding when the value of transform_skip_flag is 0, i.e., the transform is applied, and Table 10 may show syntax elements of the residual coding when the value of transform_skip_flag is 1, i.e., the transform is not applied.

[0136] Specifically, for example, a transform skip flag indicating whether or not a transform block is to be skipped 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, syntax elements for residual coefficients of the transform block, such as sig_coeff_flag, coeff_sign_flag, abs_level_gtx_flag, and / or abs_remainder, may be parsed as shown in Table 10, and the residual coefficients may be derived based on the syntax elements. In this case, the syntax elements may be parsed sequentially, and the parsing order may be changed. Also, the abs_level_gtx_flag may represent abs_level_gt1_flag, abs_level_gt3_flag, abs_level_gt5_flag, abs_level_gt7_flag, and / or abs_level_gt9_flag. For example, "abs_level_gtx_flag[n][j" may be a flag indicating whether the absolute value of the transform coefficient level (or the value obtained by shifting the transform coefficient level by 1 to the right) at scanning position n is greater than (j<<1)+1. The (j<<1)+1 may be replaced with a predetermined threshold value such as a first threshold value or a second threshold value, depending on the case.

[0137] Also, when the value of the transform skip flag is 0, syntax elements for the residual coefficients of the transform block, such as sig_coeff_flag, abs_level_gtx_flag, par_level_flag, abs_remainder, dec_abs_level, and coeff_sign_flag, may be parsed as shown in Table 9, and the residual coefficients may be derived based on the syntax elements. In this case, the syntax elements may be parsed sequentially, and the parsing order may be changed. Also, the 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 the abs_level_gtx_flag[n][1] may be an example of a second transform coefficient level flag (abs_level_gt3_flag).

[0138] As described above, when comparing syntax elements for residual coefficients when no transformation is applied with syntax elements for residual coefficients when transformation is applied, the syntax element par_level_flag may not be encoded and decoded. This is because, when the level value of the residual coefficient is large, coding all syntax elements such as sig_coeff_flag, par_level_flag, abs_level_gtx_flag, etc. for all residual coefficients is more likely to transmit overlapping information than binarizing and transmitting the level value of the residual coefficient as it is, and therefore, in the present embodiment, when a transformation skip is applied in which the level value of the residual coefficient may be large, the syntax element par_level_flag is omitted, thereby improving coding efficiency.

[0139] On the other hand, CABAC provides high performance but has a drawback of poor throughput performance. This is due to the regular encoding engine of CABAC, and regular encoding (i.e., encoding by the regular encoding engine of CABAC) shows high data dependency because it uses the probability state and range updated by encoding the previous bin, and it takes a lot of time to read the probability interval and determine the current state. The throughput problem of CABAC can be solved by limiting the number of context-coded bins. For example, as shown in Table 1, Table 6, Table 9, or Table 10, the sum of the bins used to express sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag is limited to a number according to the size of the block. For example, if the block is a 4x4 block, the sum of bins for the sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag is limited to 32, and if the block is a 2x2 block, the sum of bins for the sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag is limited to 8. The limited number of bins can be represented by remBinsPass1. Or, for example, for a higher CABAC throughput, the number of context coded bins is limited for a block (CB or TB) including a CG to be coded. In other words, the number of context coded bins is limited in block (CB or TB) units. For example, if the size of the current block is 16×16, the number of context coding bins for the current block is limited to 1.75 times the number of pixels in the current block, i.e., 448, regardless of the current CG.

[0140] In this case, when the encoding apparatus uses all of the limited number of context coding bins to code the context elements, it binarizes the remaining coefficients using a binarization method for the coefficients described below without using CABAC, and performs bypass encoding. In other words, for example, when the number of context coding bins coded for 4×4 CG is 32, or the number of context coding bins coded for 2×2 CG is 8, sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag coded at the context coding bins are not encoded any more, and may be directly encoded at dec_abs_level as shown in Table 8 below. In addition, for example, if the number of context coded bins coded for a 4x4 block is limited to 1.75 times the number of pixels in the entire block, i.e., 28, sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag coded in the context coded bins further than this may not be encoded and may be immediately encoded in dec_abs_level as shown in Table 8 below.

[0141] [Table 11]

[0142] The |coeff| value may be derived based on dec_abs_level. In this case, the transform coefficient value |coeff| may be derived as follows:

[0143]

number

[0144] Also, the coeff_sign_flag may represent the sign of a transform coefficient level at a corresponding scanning position n. That is, the coeff_sign_flag may represent the sign of a transform coefficient at a corresponding scanning position n. Also, the mts_idx may represent transform kernels, etc. applied to residual samples, etc. in the current transform block in the horizontal and vertical directions.

[0145] FIG. 5 is a diagram illustrating an example of transform coefficients in a 4×4 block.

[0146] The 4x4 blocks in Figure 5 show an example of quantized coefficients, etc. The blocks shown in Figure 5 can be 4x4 transform blocks or 4x4 sub-blocks of 8x8, 16x16, 32x32, 64x64 transform blocks. The 4x4 blocks in Figure 5 can represent luma blocks or chroma blocks.

[0147] For example, the encoding results for the reverse diagonal scanned coefficients of FIG.

[0148] [Table 12]

[0149] In the above Table 12, scan_pos represents the position of a coefficient according to the reverse diagonal scan. scan_pos15 may be the transform coefficient scanned first in a 4×4 block, i.e., the bottom right corner, and scan_pos0 may be the transform coefficient scanned last, i.e., the top left corner. Meanwhile, in one embodiment, the scan_pos may also be referred to as a scan position. For example, the scan_pos0 may be referred to as a scan position 0.

[0150] Meanwhile, as described above, when an input signal is a syntax element that is not a binary value, the encoding apparatus can binarize the value of the input signal to convert the input signal into a binary value. Also, the decoding apparatus can decode the syntax element to derive a binarized value (i.e., a binarized bin) of the syntax element, and can de-binarize the binarized value to derive the value of the syntax element. The binarization process can be performed as a Truncated Rice (TR) binarization process, a k-th order Exp-Golomb (EGk) binarization process, a k-th order Limited Exp-Golomb (Limited k-th order Exp-Golomb, Limited EGk), or a Fixed-length (FL) binarization process, which will be described later. Also, a debinarization process may represent a process of deriving the value of the syntax element based on the TR binarization process, the EGk binarization process, or the FL binarization process.

[0151] For example, the TR binarization process can be performed as follows.

[0152] The input of the TR binarization process may be the TR binarization request and syntax elements cMax and cRiceParam, and the output of the TR binarization process may be the TR binarization for the value symbolVal corresponding to the bin string.

[0153] Specifically, as an example, if a suffix bin string exists for a syntax element, the TR bin string for the syntax element may be a concatenation of a prefix bin string and a suffix bin string, and if the suffix bin string does not exist, the TR bin string for the syntax element may be the prefix bin string. For example, the prefix bin string may be derived as described below.

[0154] The prefix value of the symbolVal for the syntax element can be derived as follows:

[0155]

number

[0156] Here, prefixVal may represent a prefix value of the symbolVal. The prefix of the TR bin string of the syntax element (ie, the prefix bin string) may be derived as described below.

[0157] For example, if the prefixVal is less than cMax>>cRiceParam, the prefix bin string can be a bit string of length prefixVal+1 indexed by binIdx. That is, if the prefixVal is less than cMax>>cRiceParam, the prefix bin string can be a bit string of prefixVal+1 bits pointed to by binIdx. The bin for binIdx less than prefixVal can be equal to 1. Also, the bin for binIdx equal to prefixVal can be equal to 0.

[0158] For example, the bit string derived by unary binarization for the prefixVal can be as shown in the following table.

[0159]

Table 13

[0160] On the other hand, when the prefixVal is not smaller than cMax >> cRiceParam, the prefix bit string can be a bit string with a length of cMax >> cRiceParam and all bits being 1.

[0161] Also, when cMax is larger than symbolVal and cRiceParam is larger than 0, a suffix bit string of the TR bit string may exist. For example, the suffix bit string can be derived as described later.

[0162] The suffix value of the symbolVal for the syntax element can be derived as in the following formula.

[0163]

Equation

[0164] Here, suffixVal can represent the suffix value of the symbolVal.

[0165] The suffix of the TR bit string (i.e., the suffix bit string) can be derived based on the FL binarization process for suffixVal where the cMax value is (1 << cRiceParam) - 1.

[0166] On the other hand, if the value of the input parameter cRiceParam is 0, the TR binarization can be exactly truncated unary binarization, and a cMax value equal to the maximum possible value of the syntax element being decoded can always be used.

[0167] Also, for example, the EGk binarization process can be performed as follows: The syntax elements coded in ue(v) can be Exp-Golomb coded syntax elements.

[0168] As an example, a 0-th order Exp-Golomb (EG0) binarization process can be performed as follows.

[0169] The parsing process for the syntax element may begin by reading the bits starting from the current position in the bitstream, including the first non-zero bit, and counting the number of leading bits such as 0. This process may be represented as follows:

[0170] [Table 14]

[0171] Also, the variable codeNum can be derived as follows:

[0172]

number

[0173] Here, the value returned by read_bits(leadingZeroBits), i.e., the value represented by read_bits(leadingZeroBits), can be interpreted as a binary representation of an unsigned integer for the first recorded most significant bit.

[0174] The structure of the Exp-Golomb code, which separates a bit string into "prefix" bits and "suffix" bits, can be represented as in the following table.

[0175] [Table 15]

[0176] The "prefix" bits may be parsed bits as described above for leadingZeroBits calculation and may be represented as 0 or 1 in the bit string in Table 15. That is, the bit strings disclosed as 0 or 1 in Table 15 above may represent the prefix bit string. The "suffix" bits may be parsed bits in codeNum calculation and may be represented as xi in Table 15 above. That is, the bit strings disclosed as xi in Table 15 above may represent the suffix bit string. Here, i may be a value ranging from 0 to LeadingZeroBits-1. Also, each xi may be equal to 0 or 1.

[0177] The bit string assigned to the codeNum may be as follows:

[0178] [Table 16]

[0179] If the descriptor of a syntax element is ue(v), i.e., if the syntax element is coded with ue(v), the value of the syntax element may be equal to codeNum.

[0180] Also, for example, the EGk binarization process can be performed as follows.

[0181] An input of the EGk binarization process may be a request for EGk binarization, and an output of the EGk binarization process may be an EGk binarization for a value symbolVal corresponding to a bin string.

[0182] The bit string of the EGk binarization process for symbolVal can be derived as follows:

[0183] [Table 17]

[0184] Referring to Table 17 above, a binary value X can be added to the end of the bin string via each call to put(x), where x can be 0 or 1.

[0185] Also, for example, the Limited EGk binarization process can be performed as follows.

[0186] The input of the Limited EGk binarization process may be a request for Limited EGk binarization and a Rice parameter riceParam, a variable representing the binary logarithm of the maximum value log2TransformRange, and a variable representing the maximum prefix extension length maxPreExtLen, and the output of the Limited EGk binarization process may be Limited EGk binarization for a value symbolVal corresponding to a bin string.

[0187] The bit string of the Limited EGk binarization process for symbolVal can be derived as follows:

[0188] [Table 18]

[0189] Also, for example, the FL binarization process can be performed as follows.

[0190] An input of the FL binarization process may be a request for FL binarization and cMax for the syntax element, and an output of the FL binarization process may be an FL binarization for a value symbolVal corresponding to a bin string.

[0191] FL binarization may be implemented using a bit string having a number of bits that is a fixed length of the symbol value symbolVal, where the fixed length bit string may be an unsigned integer bit string. That is, a bit string for the symbol value symbolVal may be derived by FL binarization, and the bit length (i.e., the number of bits) of the bit string may be a fixed length.

[0192] For example, the fixed length can be derived as follows:

[0193]

number

[0194] The indexing of bins for FL binarization may be in a manner that uses values ​​that increase in order from the most significant bit to the least significant bit. For example, the bin index associated with the most significant bit may be binIdx=0.

[0195] Meanwhile, for example, a binarization process for the syntax element abs_remainder of the residual information can be performed as follows.

[0196] The input of the binarization process for the abs_remainder may be a binarization request for the syntax element abs_remainder[n], a color component cIdx, and a luma position (x0, y0), which may refer to the top left sample of the current luma transform block based on the top left luma sample of the picture.

[0197] An output of the binarization process for the abs_remainder may be the binarization of the abs_remainder (i.e., a binarized bin string of the abs_remainder). The binarization process may result in an available bin string for the abs_remainder, etc.

[0198] First, lastAbsRemainder and lastRiceParam for abs_remainder[n] can be derived as follows: Here, the lastAbsRemainder may represent a value of abs_remainder derived before the abs_remainder[n], and the lastRiceParam may represent a rice parameter cRiceParam for abs_remainder derived before the abs_remainder[n].

[0199] For example, when the process of deriving lastAbsRemainder and lastRiceParam for the abs_remainder[n] is called for the first time for the current sub-block, i.e., when the process of abs_remainder[n] is performed for the first transform coefficient in the scanning order among the transform coefficients of the current sub-block, the lastAbsRemainder and lastRiceParam can both be set to 0.

[0200] Also, if not, i.e., if the process is not invoked for the first time for the current sub-block, the lastAbsRemainder and the lastRiceParam can be set to the same values ​​as the abs_remainder[n] and cRiceParam derived from the last invocation, respectively. That is, the lastAbsRemainder can be derived with the same value as the abs_remainder[n] coded before the currently coded abs_remainder[n], and the lastRiceParam can be derived with the same value as the cRiceParam for the abs_remainder[n] coded before the currently coded abs_remainder[n].

[0201] Then, a Rice parameter cRiceParam for the currently coded abs_remainder[n] can be derived based on the lastAbsRemainder and the lastRiceParam. For example, the Rice parameter cRiceParam for the currently coded abs_remainder[n] can be derived as follows:

[0202]

number

[0203] Also, for example, cMax for the currently coded abs_remainder[n] can be derived based on the Rice parameter cRiceParam. The cMax can be derived as follows:

[0204]

number

[0205] Alternatively, for example, the Rice parameter cRiceParam may be determined based on whether or not a transform skip is performed for the current block. That is, when no transform is applied to the current TB including the current CG, in other words, when a transform skip is applied to the current TB including the current CG, the Rice parameter cRiceParam may be derived to be 1. Alternatively, when a transform is applied to the current TB including the current CG, in other words, when a transform skip is not applied to the current TB including the current CG, as described above, the Rice parameter cRiceParam for the currently coded abs_remainder[n] may be derived to be the same value as the cRiceParam for the previously coded abs_remainder[n].

[0206] Meanwhile, the binarization for the abs_remainder, i.e., the bin string for the abs_remainder, may be a concatenation of a prefix bin string and a suffix bin string if a suffix bin string exists, or the bin string for the abs_remainder may be the prefix bin string if the suffix bin string does not exist.

[0207] For example, the prefix bin string can be derived as described below.

[0208] The prefix value prefixVal of the abs_remainder[n] can be derived as follows:

[0209]

number

[0210] The prefix of the bin string of the abs_remainder[n] (ie, the prefix bin string) may be derived by a TR binarization process on the prefixVal using the cMax and the cRiceParam as inputs.

[0211] If the prefix bin string is identical to a bit string with all bits being 1 and a bit length of 6, then a suffix bin string of the bin string of abs_remainder[n] may exist and may be derived as described below.

[0212] The suffix value suffixVal of the abs_remainder can be derived as follows:

[0213]

number

[0214] The suffix bin string of the bin string of the abs_remainder can be derived by a Limited EGk binarization process on the suffixVal where k is set to cRiceParam+1, riceParam is set to cRiceParam, log2TransformRange is set to 15, and maxPreExtLen is set to 11.

[0215] Meanwhile, for example, a binarization process for the syntax element dec_abs_level of the residual information can be performed as follows.

[0216] Inputs of the binarization process for the dec_abs_level may be a binarization request for syntax element dec_abs_level[n], a color component cIdx, a luma position (x0, y0), a current coefficient scan position (xC, yC), log2TbWidth, which is the binary logarithm of the width of the transform block, and log2TbHeight, which is the binary logarithm of the height of the transform block. The luma position (x0, y0) may refer to the top left sample of the current luma transform block based on the top left luma sample of the picture.

[0217] An output of the binarization process for the dec_abs_level may be the binarization of the dec_abs_level (i.e., the binarized bin string of the dec_abs_level). The binarization process may derive an available bin string for the dec_abs_level, etc.

[0218] The Rice parameter cRiceParam for the dec_abs_level[n] may be derived through a Rice parameter derivation process that is performed using the hue component cIdx, the luma position (x0, y0), the current coefficient scan position (xC, yC), log2TbWidth, which is the binary logarithm of the width of the transform block, and log2TbHeight, which is the binary logarithm of the height of the transform block, as inputs. The Rice parameter derivation process will be described in detail later.

[0219] Also, for example, cMax for the dec_abs_level[n] can be derived based on the Rice parameter cRiceParam. The cMax can be derived as follows:

[0220]

number

[0221] Meanwhile, the binarization for the dec_abs_level[n], i.e., the bin string for the dec_abs_level[n], may be a concatenation of a prefix bin string and a suffix bin string if a suffix bin string exists, or, if the suffix bin string does not exist, the bin string for the dec_abs_level[n] may be the prefix bin string.

[0222] For example, the prefix bin string can be derived as described below.

[0223] The prefix value prefixVal of the dec_abs_level[n] can be derived as follows:

[0224]

number

[0225] The prefix of the bin string of the dec_abs_level[n] (ie, the prefix bin string) may be derived by a TR binarization process on the prefixVal using the cMax and the cRiceParam as inputs.

[0226] If the prefix bin string is identical to a bit string with all bits being 1 and a bit length of 6, then a suffix bin string of the bin string of the dec_abs_level[n] may exist and may be derived as described below.

[0227] The Rice parameter derivation process for dec_abs_level[n] may be as follows.

[0228] The input of the Rice parameter derivation process may be a color component index cIdx, a luma position (x0, y0), a current coefficient scan position (xC, yC), a binary logarithm of a width of a transform block, log2TbWidth, and a binary logarithm of a height of a transform block, log2TbHeight. The luma position (x0, y0) may refer to the top left sample of a current luma transform block based on the top left luma sample of a picture. Also, an output of the Rice parameter derivation process may be the Rice parameter cRiceParam.

[0229] For example, based on given syntax elements such as sig_coeff_flag[x][y], the component index cIdx, and the array AbsLevel[x][y] for a transform block having the top left luma position (x0, y0), the variable locSumAbs can be derived as a pseudo code disclosed in the following table.

[0230] [Table 19]

[0231] The rice parameter cRiceParam can be derived as follows.

[0232] For example, the rice parameter cRiceParam may be derived based on the derived variable locSumAbs and a variable s, which may be set to Max(0, QState-1), i.e., s may be set to the maximum value between 0 and QState-1.

[0233] The rice parameters cRiceParam and ZeroPos[n] derived based on the variables locSumAbs and s may be as follows:

[0234] [Table 20]

[0235] For example, referring to Table 20 above, if the locSumAbs is 6 or less, the cRiceParam can be set to 0; if the locSumAbs is 7 or more and 13 or less, the cRiceParam can be set to 1; if the locSumAbs is 14 or more and 27 or less, the cRiceParam can be set to 2; and if the locSumAbs is 28 or more, the cRiceParam can be set to 3.

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

[0237] Or, for example, ZeroPos[n] can be derived as follows, where cRiceParam included in the formula described below can be derived with reference to Table 20:

[0238]

number

[0239] In addition, the suffix value suffixVal of the dec_abs_level[n] can be derived as follows:

[0240]

number

[0241] The suffix bin string of the bin string of the dec_abs_level[n] can be derived by a Limited EGk binarization process on the suffixVal where k is set to cRiceParam+1, riceParam is set to cRiceParam, log2TransformRange is set to 15, and maxPreExtLen is set to 11.

[0242] This document also proposes a method for modifying existing residual coding methods as described below in order to adapt the statistics and signal characteristics of transform skip levels (i.e., residuals in the spatial domain) representing quantized prediction residuals to residual coding.

[0243] Scanning order: For example, the scanning order for sub-blocks in a TB block and residual coefficients in the sub-blocks may be a diagonal scan order moving from the bottom right to the top left. That is, the scanning order for sub-blocks in a TB block and residual coefficients in the sub-blocks may be a diagonal scan order scanning from the bottom right to the top left. Or, for example, the scanning order for sub-blocks in a TB block and residual coefficients in the sub-blocks may be a diagonal scan order moving from the top left to the bottom right. That is, the scanning order for sub-blocks in a TB block and residual coefficients in the sub-blocks may be a diagonal scan order scanning from the top left to the bottom right.

[0244] No last non-zero transform coefficient position: The residual signal (i.e., the residual sample) reflects the spatial residual after prediction, and since no energy compression due to transform is performed with transform skip, the high probability for trailing zeros or insignificant levels at the bottom right corner of the transform block may not occur any more. Therefore, in this case, signaling information regarding the scanning position of the last non-zero transform coefficient may be omitted. Instead, the first sub-block to be coded earliest may be the top left sub-block in the transform block. Meanwhile, the non-zero transform coefficient may also be expressed as a significant coefficient.

[0245] Sub-block CBF: In the absence of signaling of information about the scanning position of the last non-zero transform coefficient, the CBF signaling of sub-blocks for which transform skipping is applied and which have coded_sub_block_flag shall be modified as follows:

[0246] Due to quantization, the sequence of non-significant levels mentioned above can still occur locally within a transform block, so the information about the scanning position of the last non-zero transform coefficient is removed as mentioned above and coded_sub_block_flag can be coded for all sub-blocks.

[0247] Also, coded_sub_block_flag for a subblock (top left subblock) for a DC frequency position may represent a special case. For example, in VVC Draft 3, coded_sub_block_flag for the top left subblock may be derived to be always equal to 1 without being signaled. If the scanning position of the last non-zero transform coefficient is located in a subblock other than the top left subblock, it may represent that there is at least one significant level outside the DC subblock (i.e., the top left subblock). As a result, coded_sub_block_flag for the DC subblock may be derived to be 1, but may only include 0 / non-significant levels. As described above, if a transform skip is applied to the current block and there is no information regarding the scanning position of the last non-zero transform coefficient, coded_sub_block_flag for each subblock may be signaled. Here, coded_sub_block_flag for the DC sub-block may also be included, except when coded_sub_block_flag for all sub-blocks other than the DC sub-block is already 0. Meanwhile, for example, when a diagonal scan order moving from the lower right to the upper left is applied as the scanning order of the transform block and coded_sub_block_flag for the DC sub-block is not signaled, coded_sub_block_flag for the DC sub-block may be derived to be equal to 1 (inferDcSbCbf=1). Therefore, since the DC sub-block must have at least one valid level, when all sig_coeff_flag other than sig_coeff_flag for the first position of (0,0) in the DC sub-block are 0, sig_coeff_flag for the first position of (0,0) is not signaled and may be derived to be equal to 1 (inferSbDcSigCoeffFlag=1).

[0248] Also, the context modeling of coded_sub_block_flag may be changed. For example, the context model index may be calculated by logical separation 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 coded_sub_block_flag.

[0249] sig_coeff_flag context modeling: The local template for sig_coeff_flag context modeling can be modified to include only the left position NB0 and the upper position NB1 of the current scanning position. The context model offset can be derived as the number of valid peripheral positions sig_coeff_flag[NB0]+sig_coeff_flag[NB1]. Therefore, the selection of different context sets according to the diagonal d of the current transform block can be eliminated. As a result, three context models and a single context model can be set to code sig_coeff_flag.

[0250] abs_level_gt1_flag and par_level_flag Context Modeling: A single context model can be used for abs_level_gt1_flag and par_level_flag.

[0251] abs_remainder coding: The empirical distribution of the transform skip residual absolute levels still fits the Laplacian or geometric distribution, but there may be more instability than in the transform coefficient absolute levels. In particular, the variance within a window of successive realizations may be higher relative to the residual absolute levels. This allows the binarization and context modeling of abs_remainder to be modified as follows:

[0252] For example, a higher cutoff value may be used for binarization of abs_remainder. Through this, higher compression efficiency may be provided for the switch point to Rice code for abs_remainder and dedicated context model for each bin position in coding using sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag. By increasing the cutoff, more "greater than x" flags (e.g., abs_level_gt5_flag, abs_level_gt7_flag, etc.) may be generated before the cutoff is reached. The cutoff may be fixed at 5 (numGtFlags=5).

[0253] Also, the templates for the Rice parameter derivation can be modified, i.e., only the right and lower peripheral positions of the current scanning position can be considered as local templates for sig_coeff_flag context modeling.

[0254] coeff_sign_flag context modeling: Even if the global empirical distribution is almost uniform due to instability within the sign sequence and the residual of the prediction residual is often biased, the sign-related information can be coded using a context model. A single dedicated context model can be used to code the sign-related information, which can be parsed after sig_coeff_flag and maintained with all context coded bins.

[0255] Reduction of Context Coded Bins, etc.: The transmission of syntax elements, i.e., sig_coeff_flag, abs_level_gt1_flag, and par_level_flag for the first scanning pass may not be changed. However, the restriction on the maximum number of Context Coded Bins per sample (CCBs) may be removed and adjusted differently. Reduction of CCBs may be derived by designating the mode as invalid if CCB>k, where k may be a positive integer. For example, k=2 for regular level coding mode. The above restriction may correspond to a reduction of the quantization space.

[0256] The syntax elements related to the residual data coded with the above modifications can be expressed as follows:

[0257] [Table 21]

[0258] Meanwhile, a context index (ctxIdx) indicating a context model of a context-based coded syntax element included in the residual information can be derived as described below.

[0259] For example, the input of the process of deriving a context index for a syntax element may be binIdx, which represents the position of the current bin in the bin string for the syntax element, and ctxTable, ctxIdx, and bypassFlag may be derived as outputs.

[0260] First, ctxInc for a current bin for a syntax element may be derived, that is, ctxInc may be derived based on binIdx, which indicates the position of the current bin for the syntax element. The ctxInc may be expressed as a context increment parameter.

[0261] The ctxInc derived by binIdx for a syntax element can be as follows:

[0262] [Table 22-1]

[0263] [Table 22-2]

[0264] [Table 22-3]

[0265] The context index for a bin having a value other than "bypass", "terminate", or "na" in Table 22 can be derived as follows.

[0266] The ctxInc for the current bin of the syntax element may be derived from a value specified as an item for the current bin in Table 22. Also, if there are multiple values ​​specified as an item for the current bin, the ctxinc may be derived through a procedure of a clause disclosed in parentheses for the item. The clause may mean a clause disclosed in the VVC standard. Then, a variable ctxIdxOffset may be set to the lowest value of ctxIdx according to the current value of initType. Also, a context index (ctxIdx) for the current bin of the syntax element may be set to the same as the sum of ctxInc and ctxIdxOffset. That is, the context index may be set to the sum of ctxInc and ctxIdxOffset. Also, bypassFlag may be set to 0.

[0267] On the other hand, if the item for the current bin in Table 22 is "bypass", the context index of the bin can be derived as follows. For example, ctxTable for the current bin can be set to 0, the context index (ctxIdx) for the current bin can be set to 0, and bypassFlag can be set to 1.

[0268] On the other hand, if the item for the current bin in Table 22 is "terminate", the context index of the bin can be derived as follows. For example, ctxTable for the current bin can be set to 0. Also, the context index (ctxIdx) for the current bin can be set to 0. Also, bypassFlag can be set to 0.

[0269] On the other hand, if the item for the current bin in Table 22 is "na", the syntax elements for the bin, i.e., the context index for the bin, can be derived as follows: For example, ctxIdx, ctxTable, and / or bypassFlag for the current bin may not occur.

[0270] The process, such as clauses, for deriving ctxInc for bins having values ​​that are not "bypass", "terminate", or "na" may be as described below.

[0271] For example, the process of deriving ctxInc according to section 9.5.4.2.2 can be as follows:

[0272] [Table 23]

[0273] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.3 can be as follows:

[0274] [Table 24]

[0275] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.4 can be as follows:

[0276] [Table 25]

[0277] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.5 can be as follows:

[0278] [Table 26]

[0279] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.6 can be as follows:

[0280] [Table 27]

[0281] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.7 can be as follows:

[0282] [Table 28]

[0283] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.8 can be as follows:

[0284] [Table 29]

[0285] Meanwhile, as described above, a block not subjected to transform encoding, i.e., a transform block including residual coefficients to which no transform is applied, has a different characteristic of residual information from a block to which general transform encoding is applied, and therefore an efficient residual data encoding method for a block not subjected to transform encoding is required. Meanwhile, as described above, a transform skip flag indicating whether or not a transform is applied may be transmitted in units of a transform block, and the size of the transform block is not limited in this document. For example, if the value of the transform skip flag is 1, the residual information encoding / decoding method proposed in this document may be performed, and if the value of the transform skip flag is 0, the existing residual information encoding / decoding method described in Table 1, Table 6, or Table 9 may be performed. Alternatively, if the transform skip flag indicates that no transform is applied to the current block (transform is skipped), the residual information encoding / decoding method in the transform skip mode disclosed in Table 10 or Table 21 may be performed.

[0286] On the other hand, if no transform is applied to the current block, the transform coefficients can be derived from residual samples, and thus the residual samples in the case of transform skipping can be referred to as coefficients or residual coefficients.

[0287] As described in Table 1, Table 6, or Table 9, for residual encoding / decoding, the significance coefficient flag, the first transform coefficient level flag, the parity level flag, and the second transform coefficient level flag may be encoded / decoded, and a syntax element for a remain level value, i.e., abs_remainder or dec_abs_level may be encoded / decoded, and then a sign flag for each residual coefficient may be encoded / decoded. Here, the significance coefficient flag may be sig_coeff_flag, the parity level flag may be par_level_flag, the first transform coefficient level flag may be abs_level_gt1_flag, and the second transform coefficient level flag may be abs_level_gt3_flag or abs_level_gtx_flag. Also, the sign flag may be the above-mentioned coeff_sign_flag.

[0288] Meanwhile, the sign flag may be encoded / decoded as described in the description of Table 21. In this case, unlike the sign flag being bypass coded in Table 1, Table 6, or Table 9, the sign flag may be encoded / decoded based on a context model.

[0289] Here, in the case of a transform skipped block (i.e., a block to which no transform is applied), since no transform is applied, the residual coefficients in the transform skipped block are likely to have similar signs to the surrounding residual coefficients.

[0290] Therefore, this embodiment of the present document proposes a method of determining a context table (ctxTable) of a sign flag of a residual coefficient of a transform-skipped residual signal, i.e., a transform-skipped block, based on the sign flags of neighboring residual coefficients of the residual coefficient, and context-coding the sign flag of the residual coefficient based on the determined context table. That is, this embodiment of the present document proposes a method of determining a context table (ctxTable) of a sign flag of a residual coefficient of a transform-skipped residual signal, i.e., a transform-skipped block, based on the sign flag of a residual coefficient encoded / decoded immediately before the residual coefficient, and context-coding the sign flag of the residual coefficient based on the determined context table. This embodiment proposes a method of determining a context model for a sign flag of a residual coefficient in a current sub-block of a current block based on the sign flag of a previously coded residual coefficient of the residual coefficient in the current block, and coding the sign flag based on the determined context model.

[0291] Unlike the sign flag encoding / decoding disclosed in Table 1, Table 6, or Table 21 in the coefficient group (CG) of the transform block, in the present embodiment, the sign flag is context encoded / decoded to improve compression performance. The CG can also be expressed as a sub-block. Also, the sign flag encoding / decoding disclosed in Table 21 uses only one context model, but the present embodiment is different in that the residual coefficient is coded using a context model determined based on the sign flag of a previously coded residual coefficient among a plurality of context models.

[0292] According to the present embodiment, the sign flag can be coded in consideration of high correlation with adjacent residual coefficients. As described above, the sign flags of adjacent residual coefficients in a transform skip block tend to have similar values. In consideration of the above, the present embodiment proposes a method of selecting two context models (or context tables) based on the value (e.g., 0 or 1) of the sign flag of the previous residual coefficient according to the coefficient scan order when encoding / decoding the sign flag of the residual coefficient in the current block. Meanwhile, if the residual coefficient in the current block is coded for the first time among the residual coefficients of the current block, the context model for the sign flag of the residual coefficient is derived as a predefined context model (e.g., context model 0). Also, for example, if the sub-block including the residual coefficient in the current block is not the first sub-block coded but a previously coded sub-block exists, the context model for the sign flag of the residual coefficient can be derived based on the sign flag of the residual coefficient of the neighboring sub-block coded immediately before the residual coefficient. The above embodiment can improve the compression performance of residual information. Alternatively, the context model may be indicated based on ctxIdx or ctxInc, and the ctxIdx may be derived based on the ctxInc.

[0293] In addition, this document proposes, as another embodiment, a method of selecting one of M context models using any N (N>=1) sign flags previously encoded / decoded of the residual coefficient in the current block. For example, the context model for the sign flag of the current residual can be derived as one of three context models based on the sign flags of two residual coefficients previously encoded / decoded of the current residual coefficient in the current block. Or, for example, the context model for the sign flag of the current residual can be derived as one of six context models based on the sign flags of two residual coefficients previously encoded / decoded of the current residual coefficient in the current block. Or, for example, the context model for the sign flag of the current residual can be derived as one of three context models based on the sign flag of the left peripheral residual coefficient adjacent to the current residual coefficient and the sign flag of the upper peripheral residual coefficient of the current residual coefficient. Alternatively, for example, the context model for the sign flag of the current residual can be derived as one of six context models based on the sign flag of the left neighboring residual coefficient adjacent to the current residual coefficient and the sign flag of the upper neighboring residual coefficient of the current residual coefficient. Meanwhile, when a residual coefficient in the current block is coded for the first time among the residual coefficients of the current block, the context model for the sign flag of the residual coefficient can be derived as a predefined context model (e.g., context model 0).

[0294] For example, if the current sub-block includes five non-zero residual coefficients, and if the values ​​of the sign flags of the non-zero residual coefficients are (0, 0, 0, 1, 0), the context model value for the sign flags of the non-zero residual coefficients may be defined as (0, 0, 0, 0, 1). Here, the context model value may represent a context model. That is, if the context model value is 0, the context model value may represent context model 0, and if the context model value is 1, the context model value may represent context model 1. A pseudo code representing this embodiment may be as shown in the following table.

[0295] [Table 30]

[0296] Meanwhile, an embodiment for deriving a context model of the sign flag proposed in this document can be defined as shown in the following table.

[0297] [Table 31]

[0298] The ctxInc derivation process disclosed in Table 31 above can be as follows.

[0299] 1. Input the last sign flag (the sign flag that was encoded / decoded just before the sign flag to be coded).

[0300] 2. The last sign flag is output to ctxInc, that is, the value of the last sign flag is output to ctxInc.

[0301] Alternatively, an embodiment of deriving a context model of the sign flag proposed in this document can be defined as shown in the following table.

[0302] [Table 32]

[0303] Referring to Table 32, the context model for the bin of the syntax element coeff_sign_flag (i.e., sign flag) for the current residual coefficient is determined based on lastcoeffsignflag. Specifically, for example, the context model for the bin of the syntax element coeff_sign_flag for the current residual coefficient is determined based on ctxInc, and the ctxInc is derived as 0 if the value of lastcoeffsignflag is 0, and as 1 if the value of lastcoeffsignflag is 1. Here, lastcoeffsignflag may be the same as the value of coeff_sign_flag for the residual coefficient immediately before the current residual coefficient according to the coefficient scan order in the current block (e.g., TU). Meanwhile, if the current residual coefficient is the first residual coefficient in the current block, the lastcoeffsignflag is set to 0. That is, the initial value of lastcoeffsignflag is set to 0.

[0304] That is, for example, according to the embodiment, a context model for a bin of coeff_sign_flag of a current residual coefficient can be adaptively determined based on a value of coeff_sign_flag of a previous residual coefficient of the current residual coefficient in the coefficient scan order among residual coefficients in a current block, and thus, a bin of coeff_sign_flag of the current residual coefficient can be decoded to derive a value of coeff_sign_flag of the residual coefficient. This allows correlation between adjacent residual coefficients to be taken into consideration, and coding gain can be improved. As described above, the sign of the current residual sample can be derived using the value of coeff_sign_flag of the current residual coefficient.

[0305] Meanwhile, as described above, after the ctxInc for the coeff_sign_flag of the current residual coefficient is derived, the process of deriving a context model based on the ctxInc is the same as described above.

[0306] Specifically, ctxIdxOffset for the sign flag is derived as the minimum value among values ​​that ctxIdx for the sign flag can have. For example, in the above content, ctxIdx (context model index indicating a context model) can be derived as one value of 0 (i.e., context model 0) or 1 (i.e., context model 1), so the ctxIdxOffset can be derived as 0. Then, ctxIdx for the sign flag is derived as the sum of ctxIdxOffset and the ctxInc. Since the ctxIdxOffset is derived as 0, the ctxIdx for the sign flag can be the same as the ctxInc. Or, for example, ctxIdx (context model index indicating a context model) for the sign flag is derived as one value of 0 (i.e., context model 0) to N (i.e., context model N), in which case the ctxIdxOffset can be derived as 0. Then, ctxIdx for the sign flag is derived as the sum j of ctxIdxOffset and the ctxInc. Since the ctxIdxOffset is derived as 0, the ctxIdx for the sign flag may be the same as the ctxInc. As an example, the N may be 2 or 5.

[0307] Meanwhile, the above-mentioned embodiment may be applied to all transform skip blocks. Or, since the sign flag is encoded / decoded only for the non-zero residual coefficients, it may be more advantageous to apply the above-mentioned embodiment only when the number of non-zero residual coefficients to be the sign flag encoding / decoding target is equal to or greater than a certain number. Thus, when the residual coding method described in Table 1 or Table 6 is used, the number of previously coded non-zero residual coefficients may be derived, and whether to context-code or bypass-code the sign flag 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 equal to or greater than a specific value, 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 smaller than a specific value, the sign flag may be bypass-coded. As an example, the specific value may be 5. Specifically, for example, if the number of non-zero residual coefficients of the current sub-block is 5 or more, 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 bypass coded. Meanwhile, if the current sub-block is a 4×4 block, the number of non-zero residual coefficients may be one of 0 to 16, and if the current sub-block is a 2×2 block, the number of non-zero residual coefficients may be one of 0 to 4. This document does not limit the order in which the sign flag is coded, and any step may be applied after determining whether or not a non-zero residual coefficient exists in the current sub-block or the number of non-zero residual coefficients.

[0308] Alternatively, an embodiment may be proposed in which the sign flag is determined to be context coded / bypass coded based on a specific value derived according to the size of the current block and the number of non-zero residual coefficients. Here, the number of non-zero residual coefficients used as a threshold, i.e., the specific value, may be one of numbers from 0 to the number of samples of a current block (a block including a current sub-block), or may be controlled in sub-block units, and may be one of 0 to 16 in the case of a 4×4 sub-block, and one of 0 to 4 in the case of a 2×2 sub-block. That is, a specific value may be derived based on the size of the current block or the current sub-block, and if the number of non-zero residual coefficients of the current sub-block is equal to or greater than the specific value, 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 smaller than the specific value, the sign flag may be bypass coded.

[0309] For example, if the size of the current block is 8×8, the specific value may be derived to 5, and if the number of non-zero residual coefficients of the current sub-block is 5 or more, 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 bypass coded. Also, if the size of the current block is 4×4, the specific value may be derived to 4, and if the number of non-zero residual coefficients of the current sub-block is 4 or more, 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 4, the sign flag may be bypass coded.

[0310] Alternatively, an embodiment may be proposed in which the sign flag is determined to be context coded / bypass coded based on a specific value derived according to the size of the current block and the position of the current sub-block and the number of non-zero residual coefficients. Here, the number of non-zero residual coefficients used as a threshold, i.e., the specific value, may be one of numbers ranging from 0 to the number of samples of the current block (a block including the current sub-block), or may be one of 0 to 16 in the case of a 4×4 sub-block, and one of 0 to 4 in the case of a 2×2 sub-block, controlled in sub-block units. That is, a specific value may be derived based on the size of the current block or the current sub-block and the position of the current sub-block, and if the number of non-zero residual coefficients of the current sub-block is equal to or greater than the specific value, 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 smaller than the specific value, the sign flag may be bypass coded.

[0311] For example, if the size of the current block is 8×8 and the current sub-block is the 3rd CG that is encoded first in the order determined by the diagonal scan order, the specific value may be derived to 5, and if the number of non-zero residual coefficients of the current sub-block is 5 or more, 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 bypass coded. Here, the 3rd CG may be the lower right sub-block. Also, if the size of the current block is 8×8 and the current sub-block is the 0th CG in the order determined by the 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, the specific value may be derived to 0. Here, the 0th CG may be the upper left sub-block.

[0312] Alternatively, an embodiment may be proposed in which the sign flag is determined to be context coded / bypass coded based on a specific value derived according to the size of the current block, the position of the current sub-block, and the prediction mode of the current block and the number of non-zero residual coefficients. Here, the number of non-zero residual coefficients used as a threshold, i.e., the specific value, may be one of numbers from 0 to the number of samples of the current block (block including the current sub-block), or may be one of 0 to 16 in the case of a 4×4 sub-block, and one of 0 to 4 in the case of a 2×2 sub-block, controlled in sub-block units. That is, a specific value may be derived based on the size of the current block or the current sub-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 equal to or greater than the specific value, 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 smaller than the specific value, the sign flag may be bypass coded.

[0313] For example, if the size of the current block is 8x8, the current sub-block is the 3rd CG that is encoded first in the order determined by the diagonal scan order, and the prediction mode of the current block is an intra prediction mode, the specific value may be derived to 5, and if the number of non-zero residual coefficients of the current sub-block is 5 or more, 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 bypass coded. Here, the 3rd CG may be a lower right sub-block. Also, if the current sub-block is the 0th CG in the order determined by the 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, the specific value may be derived to 0. Here, the 0th CG may be an upper left sub-block.

[0314] Alternatively, for example, it may be determined whether to code the sign flag based on a context model or to bypass code the sign flag based on whether a transform is applicable to the current block.

[0315] FIG. 6 illustrates an example of determining a context model for the sign flag of the current residual coefficient according to the present embodiment.

[0316] As shown in Fig. 6, the encoding / decoding apparatus determines whether a current residual coefficient is the first residual coefficient to be encoded / decoded in a coefficient scan order in a current block (S610). Here, the current residual coefficient may indicate a residual coefficient to be currently encoded / decoded among residual coefficients in the current block. For example, the current block may be a transform unit (TU).

[0317] If the current residual coefficient is the first residual coefficient to be encoded / decoded in the current block, the encoding / decoding apparatus derives a variable lastcoeffsignflag for the sign flag of the current residual coefficient as 0 (S620), and sets ctxInc for the sign flag of the current residual coefficient as lastcoeffsignflag (S630). For example, referring to Table 32 above, if the value of lastcoeffsignflag is 0, the context model for the sign flag of the current residual coefficient is derived as context model 0. Specifically, for example, if the value of lastcoeffsignflag is 0, the ctxIdc for the sign flag of the current residual coefficient is derived as 0, and the ctxIdxOffset for the sign flag is derived as 0, so that the ctxIdx for the sign flag can be derived as 0 (i.e., derived as context model 0).

[0318] Alternatively, if the current residual coefficient is not the first residual coefficient to be encoded / decoded in the current block, the encoding / decoding apparatus determines whether a sign flag value (lastcoeffsignflag) of a residual coefficient previously encoded / decoded of the current residual coefficient is 0 (S640). For example, the previously encoded / decoded residual coefficient may be an adjacent residual coefficient. For example, the previously encoded / decoded residual coefficient may include at least one of a left peripheral residual coefficient and an upper peripheral residual coefficient of the current residual coefficient. Or, for example, the peripheral residual coefficient may include at least one of a right peripheral residual coefficient and a lower peripheral residual coefficient of the current residual coefficient. If the value of the sign flag of the previously encoded / decoded residual coefficient is 0, the encoding / decoding apparatus derives a variable lastcoeffsignflag for the sign flag of the current residual coefficient as 0 (S620), and sets ctxInc for the sign flag of the current residual coefficient to lastcoeffsignflag (S630).

[0319] In addition, if the value of the sign flag of the previously encoded / decoded residual coefficient is not 0, the encoding / decoding apparatus derives a variable lastcoeffsignflag for the sign flag of the current residual coefficient as 1 (S650), and sets ctxInc for the sign flag of the current residual coefficient to lastcoeffsignflag (S630).

[0320] FIG. 7 illustrates an example of an encoding apparatus and a decoding apparatus for coding a sign flag of a current residual coefficient based on whether or not a transform is applied to the current block and on the sign of a previously coded residual coefficient.

[0321] 7(a) exemplarily illustrates an encoding apparatus that encodes a sign flag of a current residual coefficient based on whether a transform is applied to the current block and the sign of a previously coded residual coefficient of the current residual coefficient. For example, as shown in FIG. 7(a), the encoding apparatus may determine whether a transform is applied to the current block, and if a transform is not applied to the current block, may derive a context model of the sign flag of the current residual coefficient based on the sign of a previously coded residual coefficient of the current residual coefficient to be encoded. Then, the encoding apparatus may context-encode the sign flag of the current residual coefficient based on the determined context model, and may transmit a bitstream including the encoded sign flag.

[0322] Also, (b) of Figure 7 exemplarily illustrates a decoding apparatus that decodes a sign flag of a current residual coefficient based on whether or not a transform is applied to the current block and the sign of a previously coded residual coefficient of the current residual coefficient. As shown in (b) of Figure 7, the decoding apparatus can derive whether or not a transform is applied to the current block based on a transform skip flag of the current block, and if a transform is not applied to the current block, can derive a context model of the sign flag of the current residual coefficient based on the sign of a previously coded residual coefficient of the current residual coefficient to be decoded. Then, the decoding apparatus can context-decode the sign flag of the current residual coefficient based on the determined context model, and can derive the current residual coefficient based on the decoded sign flag.

[0323] FIG. 8 is a schematic diagram showing a video encoding method by an encoding apparatus according to the present document. The method disclosed in FIG. 8 may be performed by the encoding apparatus disclosed in FIG. 2. Specifically, for example, S810 to S820 in FIG. 8 are performed by a residual processing unit of the encoding apparatus, and S830 to S850 are performed by an entropy encoding unit of the encoding apparatus. Although not shown, a process of deriving a predicted sample is performed by a prediction unit of the encoding apparatus, a process of deriving a residual sample for the current block based on an original sample and a predicted sample for the current block is performed by a subtraction unit of the encoding apparatus, and a process of generating a reconstructed sample and a reconstructed picture for the current block based on the residual sample and the predicted sample for the current block is performed by an addition unit of the encoding apparatus.

[0324] The encoding apparatus derives a residual sample of a current block (S810). For example, the encoding apparatus determines whether to perform inter prediction or intra prediction on the current block, and determines a specific inter prediction mode or a specific intra prediction mode based on an RD cost. Depending on the determined mode, the encoding apparatus derives a predicted sample for the current block, and derives the residual sample by subtracting an original sample for the current block from the predicted sample.

[0325] The encoding apparatus derives current residual coefficients of the current block based on the residual samples (S820).

[0326] Then, the encoding apparatus may determine whether a transform is applied to the current block. That is, the encoding apparatus may determine whether a transform is applied to the residual samples of the current block. The encoding apparatus may determine whether a transform is applied to the current block in consideration of coding efficiency. For example, the encoding apparatus may determine that a transform is not applied to the current block.

[0327] When a transform is not applied to the current block, i.e., when a transform is not applied to the residual sample, the encoding apparatus may derive the derived residual sample from the current residual coefficient. Also, when a transform is applied to the current block, i.e., when a transform is applied to the residual sample, the encoding apparatus may perform a transform on the derived residual sample to derive the current residual coefficient. 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 crowdup (CG). Also, the size of the current sub-block of the current block may be 4×4 or 2×2. That is, the current sub-block of the current block may include up to 16 non-zero residual coefficients or up to 4 non-zero residual coefficients.

[0328] Meanwhile, the encoding apparatus may generate and encode a transform skip flag indicating whether or not a transform is applied to residual coefficients, etc. of the current block. Residual information may include a transform skip flag for the current block. The transform skip flag may indicate whether or not a transform is applied to residual coefficients, etc. of the current block. That is, the transform skip flag may indicate whether or not a transform is applied to the residual coefficients, etc. A syntax element indicating the transform skip flag may be the above-mentioned transform_skip_flag.

[0329] The encoding apparatus derives a context model for the sign flag of the current residual coefficient (S830).

[0330] For example, the encoding apparatus may derive a context model for the sign flag of the current residual coefficient from among a plurality of context models.

[0331] As an example, 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 block. For example, the context model for the sign flag is derived based on the sign flag of a neighboring residual coefficient of the current residual coefficient among residual coefficients encoded (or scanned) before the current residual coefficient in a coefficient scan order for the current block. For example, if the value of the sign flag of the residual coefficient encoded before the current residual coefficient is 0, a value of a context index indicating a context model for the sign flag of the current residual coefficient is derived as 0, and if the value of the sign flag of the residual coefficient encoded before the current residual coefficient is 1, a value of a context index for the sign flag of the current residual coefficient is 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 for the sign flag of the current residual coefficient is 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 for the sign flag of the current residual coefficient is derived as context model 1. Meanwhile, for example, when the current residual coefficient is the first residual coefficient encoded in the current block, the value of a context index indicating a context model for the sign flag of the current residual coefficient is derived as 0. That is, for example, when the current residual coefficient is the first residual coefficient encoded in the current block, the context model for the sign flag of the current residual coefficient is derived as context model 0.Also, for example, if a current sub-block in the current block including the current residual coefficient is not a sub-block encoded in the first order and the current residual coefficient is the first residual coefficient encoded in the current sub-block, the residual coefficient encoded before the current residual coefficient is derived as the last encoded residual coefficient in the previously encoded sub-block of the current sub-block. That is, if a current sub-block in the current block is not a sub-block encoded in the first order and the current residual coefficient is the first residual coefficient encoded in the current sub-block, the current residual coefficient is not encoded first in the current block, but a previously encoded residual coefficient exists, so that the current residual coefficient is derived as the previously encoded residual coefficient.

[0332] Or, as another example, the context model for the sign flag is derived based on the sign flags of a plurality of residual coefficients encoded before the current residual coefficient in the current block. The context model for the sign flag can be derived as one of a plurality of context models based on the sign flags of a plurality of residual coefficients encoded before the current residual coefficient in the current block. For example, the context model for the sign flag can 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 block. Or, for example, the context model for the sign flag can be derived as one of six context models based on the sign flags of two residual coefficients encoded before the current residual coefficient in the current block.

[0333] Meanwhile, the encoding apparatus can determine whether the sign flag is encoded based on the context model, and can derive the context model for the sign flag if it is determined that the sign flag is encoded based on the context model.

[0334] For example, the encoding apparatus may determine whether the sign flag is encoded based on the context model based on a transform skip flag for the current block. That is, the encoding apparatus may determine whether the sign flag is encoded based on the context model based on whether a transform is applied to the current block. The transform skip flag may indicate whether a transform is applied to the current block. That is, the transform skip flag may indicate whether a transform is applied to a residual coefficient of the current block. The residual information for the current block may include the transform skip flag. If the value of the transform skip flag is 0, the sign flag may not be encoded based on the context model (i.e., the sign flag may be bypass encoded), and if the value of the transform skip flag is 1, the sign 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 is encoded based on the context model, and the encoding apparatus may derive the context model for the sign flag and encode the sign flag based on the context model.

[0335] Alternatively, for example, the encoding apparatus may compare the number of non-zero residual coefficients in a current sub-block with a specific value to determine whether the sign flag is encoded based on the context model. Here, the current sub-block may refer to a sub-block of the current block including the current residual coefficient. If the number of non-zero residual coefficients is smaller than the specific value, the sign flag is not encoded based on the context model (i.e., the sign flag is bypass encoded), and if the number of non-zero residual coefficients is equal to or greater than the specific value, the sign flag is encoded based on the context model. That is, if the non-zero residual coefficients are equal to or greater than the specific value, the encoding apparatus determines that the sign flag is encoded based on the context model, and the encoding apparatus may derive the context model for the sign flag and encode the sign flag based on the context model. The specific value may be expressed as a threshold.

[0336] Here, as an example, the specific value may be one of 0 to the number of samples of the current block. For example, the specific value may be one of 0 to 64. Or, for example, the specific value may be one of 0 to the number of samples of the current sub-block. That is, for example, if the size of the current sub-block is 4×4, the specific value may be one of 0 to 16, and if the size of the current sub-block is 2×2, the specific value may be one of 0 to 4. As an example, the specific value may be 5.

[0337] Alternatively, as an example, the specific value may be derived based on the size of the current block, for example, if the size of the current block is 8×8, the specific value may be derived to be 5, and if the size of the current block is 4×4, the specific value may be derived to be 4.

[0338] Or, as an example, the specific value may be derived based on the size of the current block and the position of the current sub-block within the current block.

[0339] For example, if the size of the current block is 8×8 and the current sub-block is the lower right sub-block of the current block, the specific value may be derived as 5. Here, the lower right sub-block may be the third sub-block (i.e., the third CG) in an order determined by a diagonal scan order.

[0340] Also, for example, if the size of the current block is 8×8 and the current sub-block is the upper left sub-block of the current block, the specific value may be derived as 4. Here, the upper left sub-block may be the 0th sub-block (or the 0th CG) in an order determined by a diagonal scan order.

[0341] Alternatively, as an example, the specific value may be derived based on the size of the current block, the position of the sub-block within the current block, and a prediction mode of the current block.

[0342] For example, if the size of the current block is 8×8, 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, the specific value may be derived to be 5. That is, if the size of the current block is 8×8, the current sub-block is a 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 to be 5.

[0343] Also, for example, if the size of the current block is the 8×8 size, the current sub-block is the upper left 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 to 0. That is, if the size of the current block is 8×8 size, the current sub-block is the upper left 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 to 0. As a result, it may be determined that the sign flag is encoded based on the context model, regardless of the number of non-zero residual coefficients, etc.

[0344] The encoding apparatus encodes the sign flag based on the context model (S840). The encoding apparatus encodes the sign flag based on the context model. That is, the encoding apparatus encodes the sign flag in a context-based manner based on the context model. The sign flag indicates a sign of the current residual coefficient. When the value of the sign flag is 0, the sign flag indicates that the current residual coefficient is a positive value (i.e., the sign flag indicates that the sign of the current residual coefficient is 1), and when the value of the sign flag is 1, the sign flag indicates that the current residual coefficient is a negative value (i.e., the sign flag indicates that the sign of the current residual coefficient is -1). That is, when the value of the sign flag is 0, the current residual coefficient may be a positive value, and when the value of the sign flag is 1, the current residual coefficient may be a negative value.

[0345] In addition, the encoding apparatus may encode residual information regarding the current block.

[0346] The residual information includes syntax elements for residual coefficients of the current block. The residual information includes syntax elements for current residual coefficients of the current block. Here, the syntax elements include context-based coded syntax elements and bypass coded syntax elements (i.e., syntax elements coded based on a uniform probability distribution).

[0347] 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_gt1_flag, abs_level_gtx_flag, abs_remainder, coeff_sign_flag, dec_abs_level, and / or mts_idx.

[0348] Specifically, for example, the residual information may include a transform skip flag for the current block. The transform skip flag may indicate whether a transform is applied to the current block. That is, the transform skip flag may indicate whether a transform is applied to the residual coefficients of the current block. A syntax element representing the transform skip flag may be the above-mentioned transform_skip_flag.

[0349] Also, for example, the residual information may include position information representing a position of a last non-zero residual coefficient in a residual coefficient array of the current block. That is, the residual information may include position information representing a position of a last non-zero residual coefficient in a scanning order of the current block. The position information may include information representing a prefix of a column position of the last non-zero residual coefficient, information representing a prefix of a row position of the last non-zero residual coefficient, information representing a suffix of a column position of the last non-zero residual coefficient, and information representing a suffix of a row position of the last non-zero residual coefficient. The syntax elements for 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 coefficient may be referred to as a significant coefficient.

[0350] Also, for example, the residual information includes a syntax element coded based on the context for a current residual coefficient of the current block. The syntax element includes a significance coefficient flag indicating whether the current residual coefficient is a non-zero residual coefficient, a parity level flag for a parity of a coefficient level for the current residual coefficient, a first coefficient level flag for whether the coefficient level is greater than a first threshold value, and a second coefficient level flag for whether the coefficient level of the current residual coefficient is greater than a second threshold value. Here, the significance coefficient flag may be sig_coeff_flag, the parity level flag may be par_level_flag, the first coefficient level flag may be abs_level_gt1_flag, and the second coefficient level flag may be abs_level_gt3_flag or abs_level_gtx_flag.

[0351] Also, for example, the context-based coded syntax elements for a current residual coefficient may include a sign flag indicating the sign of the current residual coefficient. As an example, when no transformation is applied to the current block (i.e., when a value of a transform skip flag is 1), the context-based coded syntax elements may include the sign flag. That is, when no transformation is applied to the current block (i.e., when a value of a transform skip flag is 1), the sign flag may be encoded based on a context model.

[0352] Also, for example, the residual information includes a syntax element coded on a bypass basis for a current residual coefficient of the current block. The bypass coded syntax element includes coefficient value related information for a value of the current residual coefficient. The information on the coefficient value may be abs_remainder and / or dec_abs_level. Also, as an example, if a transform is applied to the current block (i.e., if a value of a transform skip flag is 0), the bypass coded syntax element includes the sign flag. That is, if a transform is applied to the current block (i.e., if a value of a transform skip flag is 0), the sign flag may be bypass encoded (i.e., the sign flag may be encoded based on a uniform probability distribution).

[0353] The encoding apparatus generates a bitstream including the sign flag (S850). For example, the encoding apparatus outputs video information including residual information including the sign flag as a bitstream. The bitstream includes the residual information.

[0354] Meanwhile, the bitstream may include prediction information for the current block. The prediction information may include information regarding an inter prediction mode or an intra prediction mode performed on the current block. An encoding apparatus may generate and encode the prediction information for the current block.

[0355] Meanwhile, the bitstream can be transmitted to the decoding device via a network or a (digital) storage medium, where the network can include a broadcasting network and / or a communication network, and the digital storage medium can include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc.

[0356] FIG 9 is a schematic diagram of an encoding apparatus for performing a video encoding method according to the present document. The method disclosed in FIG 8 may be performed by the encoding apparatus disclosed in FIG 9. Specifically, for example, the residual processing unit of the encoding apparatus of FIG 9 may perform S810 to S820 of FIG 8, and the entropy encoding unit of the encoding apparatus of FIG 9 may perform S830 to S850 of FIG 8. Although not shown, the process of deriving a predicted sample may be performed by a prediction unit of the encoding apparatus, the process of deriving a reconstructed sample for the current block based on the residual sample and the predicted sample for the current block may be performed by an adder of the encoding apparatus, and the process of encoding prediction information for the current block may be performed by an entropy encoding unit of the encoding apparatus.

[0357] Figure 10 is a schematic diagram showing a video decoding method by a decoding device according to the present document. The method disclosed in Figure 10 may be performed by the decoding device disclosed in Figure 3. Specifically, for example, S1010, S1030 to S1050 in Figure 10 may be performed by an entropy decoding unit of the decoding device, S1020 in Figure 10 may be performed by a prediction unit of the decoding device, S1060 may be performed by a residual processing unit of the decoding device, and S1070 may be performed by an adder unit of the decoding device.

[0358] A decoding apparatus receives residual information for a current block (S1010). The decoding apparatus receives video information including the residual information for the current block through a bitstream. Here, the current block may be a coding block (CB) or a transform block (TB). The residual information includes syntax elements for residual coefficients of the current block. Here, the syntax elements include context-based coded syntax elements and bypass coded syntax elements (i.e., syntax elements coded based on a uniform probability distribution).

[0359] 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_gt1_flag, abs_level_gtx_flag, abs_remainder, coeff_sign_flag, dec_abs_level, and / or mts_idx.

[0360] Specifically, for example, the residual information may include a transform skip flag for the current block. The transform skip flag may indicate whether a transform is applied to the current block. That is, the transform skip flag may indicate whether a transform is applied to the residual coefficients of the current block. A syntax element representing the transform skip flag may be the above-mentioned transform_skip_flag.

[0361] Also, for example, the residual information may include position information representing a position of a last non-zero residual coefficient in a residual coefficient array of the current block. That is, the residual information may include position information representing a position of a last non-zero residual coefficient in a scanning order of the current block. The position information may include information representing a prefix of a column position of the last non-zero residual coefficient, information representing a prefix of a row position of the last non-zero residual coefficient, information representing a suffix of a column position of the last non-zero residual coefficient, and information representing a suffix of a row position of the last non-zero residual coefficient. The syntax elements for 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 coefficient may be referred to as a significant coefficient.

[0362] Also, for example, the residual information includes a syntax element coded based on the context for a current residual coefficient of the current block. The syntax element includes a significant coefficient flag indicating whether the current residual coefficient is a non-zero residual coefficient, a parity level flag for a parity of a coefficient level for the current residual coefficient, a first coefficient level flag for whether the coefficient level is greater than a first threshold value, and a second coefficient level flag for whether the coefficient level of the current residual coefficient is greater than a second threshold value. Here, the significant coefficient flag may be sig_coeff_flag, the parity level flag may be par_level_flag, the first coefficient level flag may be abs_level_gt1_flag, and the second coefficient level flag may be abs_level_gt3_flag or abs_level_gtx_flag.

[0363] Also, for example, the context-based coded syntax elements for a current residual coefficient may include a sign flag indicating the sign of the current residual coefficient. As an example, when no transformation is applied to the current block (i.e., when a transform skip flag has a value of 1), the context-based coded syntax elements may include the sign flag. That is, when no transformation is applied to the current block (i.e., when a transform skip flag has a value of 1), the sign flag may be decoded based on a context model.

[0364] Also, for example, the residual information includes a syntax element coded on a bypass basis for a current residual coefficient of the current block. The bypass coded syntax element includes coefficient value related information for a value of the current residual coefficient. The coefficient value related information may be abs_remainder and / or dec_abs_level. Also, as an example, if a transform is applied to the current block (i.e., if a value of a transform skip flag is 0), the bypass coded syntax element includes the sign flag. That is, if a transform is applied to the current block (i.e., if a value of a transform skip flag is 0), the sign flag is bypass decoded (i.e., the sign flag is decoded based on a uniform probability distribution).

[0365] Meanwhile, the bitstream includes prediction information for the current block, the prediction information including information regarding an inter prediction mode or an intra prediction mode to be performed on the current block.

[0366] The decoding apparatus derives a prediction sample of the current block (S1020). For example, the decoding apparatus performs inter prediction or intra prediction on the current block based on the prediction information received through the bitstream, and derives a prediction sample of the current block. For example, the decoding apparatus derives a prediction mode to be applied to the current block based on the prediction information. For example, if inter prediction is applied to the current block, the decoding apparatus derives motion information of the current block based on the prediction information, and derives the prediction sample of the current block based on the motion information. Also, for example, if intra prediction is applied to the current block, the decoding apparatus derives a reference sample based on neighboring samples of the current block, and derives the prediction sample of the current block based on the reference sample and the intra prediction mode of the current block.

[0367] The decoding apparatus derives a context model for the sign flag of the current residual coefficient of the current block (S1030).

[0368] For example, the decoding apparatus derives a context model for the sign flag of the current residual coefficient from among a plurality of context models.

[0369] As an example, the context model for the sign flag is derived based on the sign flag of a residual coefficient decoded before the current residual coefficient in the current block. For example, the context model for the sign flag is derived based on the sign flag of a neighboring residual coefficient of the current residual coefficient decoded before the current residual coefficient in the current block. That is, the context model for the sign flag is derived based on the sign flag of a residual coefficient decoded (or scanned) before the current residual coefficient in the coefficient scan order for the current block. For example, if the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 0, a value of a context index indicating a context model for the sign flag of the current residual coefficient is derived as 0, and if the value of the sign flag of the residual coefficient decoded before the current residual coefficient is 1, a value of a context index indicating a context model for the sign flag of the current residual coefficient is 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 for the sign flag of the current residual coefficient is 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 for the sign flag of the current residual coefficient is derived as context model 1. Meanwhile, for example, when the current residual coefficient is the first residual coefficient decoded in the current block, the value of a context index indicating a context model for the sign flag of the current residual coefficient is derived as 0. That is, for example, when the current residual coefficient is the first residual coefficient decoded in the current block, the context model for the sign flag of the current residual coefficient is derived as context model 0.Also, for example, if a current sub-block in the current block including the current residual coefficient is not a sub-block decoded in the first order and the current residual coefficient is the first residual coefficient decoded in the current sub-block, the residual coefficient decoded before the current residual coefficient is derived as the last decoded residual coefficient in the previously decoded sub-block of the current sub-block. That is, if a current sub-block in the current block is not a sub-block decoded in the first order and the current residual coefficient is the first residual coefficient decoded in the current sub-block, the current residual coefficient is not the first residual coefficient decoded in the current block, but a previously decoded residual coefficient exists, so that the current residual coefficient can be derived as the previously decoded residual coefficient.

[0370] Or, as another example, the context model for the sign flag is derived based on the sign flags of a plurality of residual coefficients decoded before the current residual coefficient in the current block. The context model for the sign flag is derived as one of a plurality of context models based on the sign flags of a plurality of residual coefficients decoded before the current residual coefficient in the current block. For example, the context model for the sign flag is 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 block. Or, for example, the context model for the sign flag is derived as one of six context models based on the sign flags of two residual coefficients decoded before the current residual coefficient in the current block.

[0371] Meanwhile, the decoding device can determine whether the sign flag is decoded based on the context model, and if it is determined that the sign flag is decoded based on the context model, can also derive the context model for the sign flag.

[0372] For example, the decoding apparatus may determine whether the sign flag is decoded based on the context model based on a transform skip flag for the current block. That is, the decoding apparatus may determine whether the sign flag is decoded based on the context model based on whether a transform is applied to the current block. The transform skip flag may indicate whether a transform is applied to the current block. That is, the transform skip flag may indicate whether a transform is applied to residual coefficients, etc., of the current block. The residual information for the current block may include the transform skip flag. If the value of the transform skip flag is 0, the sign flag may not be decoded based on the context model (i.e., the sign flag may be bypass decoded), and if the value of the transform skip flag is 1, the sign flag may be decoded 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 is decoded based on the context model, and the decoding apparatus may derive the context model for the sign flag and decode the sign flag based on the context model.

[0373] Alternatively, for example, the decoding apparatus may compare a non-zero residual coefficient in a current sub-block with a specific value to determine whether the sign flag is decoded based on the context model. Here, the current sub-block may refer to a sub-block of the current block including the current residual coefficient. If the number of the non-zero residual coefficients is smaller than the specific value, the sign flag is not decoded based on the context model (i.e., the sign flag is bypass decoded), and if the number of the non-zero residual coefficients is equal to or greater than the specific value, the sign flag may be decoded based on the context model. In other words, if the number of the non-zero residual coefficients is equal to or greater than the specific value, the decoding apparatus may determine that the sign flag is decoded based on the context model, and may derive the context model for the sign flag and decode the sign flag based on the context model. The specific value may be expressed as a threshold.

[0374] Here, as an example, the specific value may be one of 0 to the number of samples of the current block. For example, the specific value may be one of 0 to 64. Or, for example, the specific value may be one of 0 to the number of samples of the current sub-block. That is, for example, if the size of the current sub-block is 4×4, the specific value may be one of 0 to 16, and if the size of the current sub-block is 2×2, the specific value may be one of 0 to 4. As an example, the specific value may be 5.

[0375] Alternatively, as an example, the specific value may be derived based on the size of the current block, for example, if the size of the current block is 8×8, the specific value may be derived to be 5, and if the size of the current block is 4×4, the specific value may be derived to be 4.

[0376] Or, as an example, the specific value may be derived based on the size of the current block and the position of the current sub-block within the current block.

[0377] For example, if the size of the current block is 8×8 and the current sub-block is the lower right sub-block of the current block, the specific value may be derived as 5. Here, the lower right sub-block may be the third sub-block (i.e., the third CG) in an order determined by a diagonal scan order.

[0378] Also, for example, if the size of the current block is 8×8 and the current sub-block is the upper left sub-block of the current block, the specific value may be derived as 4. Here, the upper left sub-block may be the 0th sub-block (or the 0th CG) in an order determined by a diagonal scan order.

[0379] Alternatively, as an example, the specific value may be derived based on the size of the current block, the position of the sub-block within the current block, and a prediction mode of the current block.

[0380] For example, if the size of the current block is 8×8, 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, the specific value may be derived to be 5. That is, if the size of the current block is 8×8, the current sub-block is a 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 to be 5.

[0381] Also, for example, if the size of the current block is the 8×8 size, the current sub-block is the upper left 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 to 0. That is, if the size of the current block is 8×8 size, the current sub-block is the upper left 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 to 0. As a result, it may be determined that the sign flag is decoded based on the context model regardless of the number of non-zero residual coefficients.

[0382] The decoding apparatus decodes the sign flag based on the context model (S1040). The decoding apparatus can decode the sign flag based on the context model. The sign flag indicates the sign of the current residual coefficient. When the value of the sign flag is 0, the sign flag indicates that the current residual coefficient is a positive value (i.e., the sign flag indicates that the sign of the current residual coefficient is 1), and when the value of the sign flag is 1, the sign flag indicates that the current residual coefficient is a negative value (i.e., the sign flag indicates that the sign of the residual coefficient is -1). That is, when the value of the sign flag is 0, the current residual coefficient may be a positive value, and when the value of the sign flag is 1, the current residual coefficient may be a negative value.

[0383] The decoding apparatus derives the current residual coefficient based on the sign flag (S1050). The decoding apparatus derives the size (i.e., level value) of the current residual coefficient based on the residual information (e.g., size-related information for the current residual coefficient), and may derive the current residual coefficient of the current block as the sign of the current residual coefficient derived based on the sign flag and the size of the current residual coefficient. That is, the decoding apparatus may derive the current residual coefficient of the current block based on the sign flag for the current residual coefficient and the residual information (syntex element for the current residual coefficient).

[0384] The decoding apparatus derives a residual sample based on the current residual coefficient (S1060).

[0385] The decoding apparatus derives a residual sample of the current block based on the current residual coefficient. That is, the decoding apparatus derives a residual sample of the current block based on the current residual coefficient. For example, if it is determined based on the transform skip flag that no transform is applied to the current block, i.e., if the transform skip flag has a value of 1, the decoding apparatus may derive the current residual coefficient as the residual sample of the current block. Alternatively, for example, if it is determined based on the transform skip flag that no transform is applied to the current block, i.e., if the transform skip flag has a value of 1, the decoding apparatus may inversely quantize the current residual coefficient to derive the residual sample of the current block. Alternatively, for example, if it is determined based on the transform skip flag that a transform is applied to the current block, i.e., if the transform skip flag has a value of 0, the decoding apparatus inversely transforms the current residual coefficient to derive the residual sample of the current block. Alternatively, for example, if it is determined that a transform has been applied to the current block based on the transform skip flag, i.e., if the value of the transform skip flag is 0, the decoding device may dequantize the current residual coefficients and inverse transform the dequantized coefficients to derive the residual samples of the current block.

[0386] The decoding apparatus generates a reconstructed picture based on the prediction samples and the residual samples (S1070).

[0387] For example, the decoding apparatus may derive a prediction sample 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 the reconstructed picture by adding the prediction sample and the residual sample. For example, the prediction information may include information representing an intra prediction mode of the current block. The decoding apparatus may derive the intra prediction mode of the current block based on information representing an intra prediction mode of the current block, and may derive a prediction sample of the current block based on reference samples of the current block and the intra prediction mode. 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 N×N and the x component and y component of the top-left sample position of the current block are 0 and 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].

[0388] It has been mentioned above that in-loop filtering procedures, such as deblocking filtering, SAO and / or ALF procedures, may then be applied to the reconstructed picture in order to improve the subjective / objective image quality if necessary.

[0389] Figure 11 is a schematic diagram of a decoding device for performing a video decoding method according to the present document. The method disclosed in Figure 10 can be performed by the decoding device disclosed in Figure 11. Specifically, for example, an entropy decoding unit of the decoding device of Figure 11 can perform S1010, S1030 to S1050 of Figure 10, a prediction unit of the decoding device of Figure 11 can perform S1020 of Figure 10, a residual processing unit of the decoding device of Figure 11 can perform S1060 of Figure 10, and an adder unit of the decoding device of Figure 11 can perform S1070 of Figure 10.

[0390] According to the above-mentioned document, the efficiency of residual coding can be increased.

[0391] In addition, according to this document, a sign flag representing the sign of a residual coefficient is coded based on a context model, thereby saving the amount of bits allocated to the sign flag for the residual coefficient and improving the overall residual coding efficiency.

[0392] In addition, according to this document, a context model for a sign flag representing the sign of a residual coefficient is derived based on the signs of surrounding residual coefficients adjacent to the residual coefficient, thereby coding the sign flag taking into account the correlation between adjacent residual coefficients, thereby saving the amount of bits allocated to the sign flag and improving the overall residual coding efficiency.

[0393] In addition, according to this document, a context model for a sign flag representing the sign of a residual coefficient is derived based on the signs of previously decoded neighboring residual coefficients of the residual coefficient, thereby coding the sign flag taking into account the correlation between adjacent residual coefficients, thereby saving the amount of bits allocated to the sign flag and improving the overall residual coding efficiency.

[0394] In the above-described embodiments, the method is described with reference to a flow chart with a series of steps or blocks, but this document is not limited to the order of steps, and certain steps may occur in a different order or simultaneously with other steps than those described above. Also, those skilled in the art will understand that the steps shown in the flow chart are not exclusive, and other steps may be included, or one or more steps of the flow chart may be deleted without affecting the scope of this document.

[0395] The embodiments described in this document may be implemented and executed on a processor, microprocessor, controller, or chip. For example, the functional units illustrated in the drawings may be implemented and executed on a computer, processor, microprocessor, controller, or chip. In this case, information (e.g., information on instructions) or algorithms for implementation may be stored in a digital storage medium.

[0396] In addition, the decoding device and encoding device to which the embodiment of this document is applied may be included in a multimedia broadcast transmitting / receiving device, a mobile communication terminal, a home cinema video device, a digital cinema video device, a surveillance camera, a video interactive device, a real-time communication device such as video communication, a mobile streaming device, a storage medium, a camcorder, a custom video (VoD) service providing device, an over-the-top video (OTT) device, an internet streaming service providing device, a three-dimensional (3D) video device, an image telephone video device, a transportation terminal (e.g., a vehicle terminal, an airplane terminal, a ship terminal, etc.), and a medical video device, and may be used to process a video signal or a data signal. For example, the over-the-top video (OTT) device may include a game console, a Blu-ray player, an internet-connected TV, a home theater system, a smartphone, a tablet PC, a digital video recorder (DVR), etc.

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

[0398] Furthermore, the embodiments of the present document may be embodied in a computer program product with program code, the program code being executable by a computer in accordance with the embodiments of the present document. The program code may be stored on a computer readable carrier.

[0399] FIG. 12 exemplarily illustrates a structural diagram of a content streaming system to which the embodiments of this document are applied.

[0400] A content streaming system to which the embodiments of this document are applied can broadly include an encoding server, a streaming server, a web server, a media repository, a user device, and a multimedia input device.

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

[0402] The bitstream may be generated by an encoding method or a bitstream generation method to which an embodiment of this document is applied, and the streaming server may temporarily store the bitstream in the process of transmitting or receiving the bitstream.

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

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

[0405] Examples of the user devices include mobile phones, smartphones, laptop computers, digital broadcasting terminals, personal digital assistants (PDAs), portable multimedia players (PMPs), navigation systems, slate PCs, tablet PCs, ultrabooks, wearable devices (e.g., smartwatches, smart glass, head mounted displays (HMDs)), digital TVs, desktop computers, digital signage, etc. Each server in the content streaming system can be operated as a distributed server, and in this case, data received by each server can be processed in a distributed manner.

[0406] The claims described in this specification may be combined in various ways. For example, the technical features of the method claims in this specification may be combined and realized as an apparatus, the technical features of the apparatus claims in this specification may be combined and realized as a method, the technical features of the method claims and the technical features of the apparatus claims in this specification may be combined and realized as an apparatus, and the technical features of the method claims and the technical features of the apparatus claims in this specification may be combined and realized as a method.

Claims

1. 1. A video decoding method performed by a decoding device, comprising: receiving residual information for a current block; deriving a context index increment for a sign flag representing a sign of a current residual coefficient of the current block; deriving a context index for the sign flag based on the context index increment; decoding the sign flag based on a context model for the sign flag indicated by the context index; deriving a current residual coefficient based on the sign flag; deriving a residual sample based on the current residual coefficient; generating a reconstructed picture based on the residual samples; the context index increment for the sign flag is derived based on a sign flag of a previously decoded residual coefficient of the current residual coefficient in the current block; The residual information includes information about absolute values ​​of transform coefficient levels at scanning positions.

2. If the value of the sign flag of the residual coefficient previously decoded of the current residual coefficient is 0, the value of the context index increment is derived as 0; The video decoding method of claim 1 , wherein if a value of the sign flag of the residual coefficient previously decoded of the current residual coefficient is one, the value of the context index increment is derived as one.

3. 2. The method of claim 1, wherein the value of the context index increment for the sign flag is derived as one of a plurality of values ​​based on sign flags of a plurality of previously decoded residual coefficients of the current residual coefficient in the current block.

4. 2. The image decoding method of claim 1, wherein when a current sub-block in the current block is not a sub-block decoded in a first order and the current residual coefficient is a residual coefficient decoded first in the current sub-block, the residual coefficient decoded before the current residual coefficient is derived as the last decoded residual coefficient in a previously decoded sub-block of the current sub-block.

5. The image decoding method of claim 1 , wherein the residual coefficient decoded before the current residual coefficient is a residual coefficient adjacent to the current residual coefficient.

6. The method of claim 1 , further comprising determining whether the sign flag is decoded based on the context model depending on whether a transform is applied to the current block.

7. If a transformation is applied to the current block, the sign flag is bypass decoded; The video decoding method of claim 6 , wherein if no transformation is applied to the current block, the sign flag is decoded based on the context model.

8. A video encoding method performed by an encoding device, comprising: deriving a residual sample for a current block; deriving current residual coefficients of the current block based on the residual samples; deriving a context index increment for a sign flag representing a sign of the current residual coefficient; deriving a context index for the sign flag based on the context index increment; encoding the sign flag based on a context model for the sign flag indicated by the context index; generating a bitstream including the sign flag and residual information; the context index increment for the sign flag is derived based on a sign flag of a previously encoded residual coefficient of the current residual coefficient in the current block; The residual information includes information about absolute values ​​of transform coefficient levels at scanning positions.

9. If the value of the sign flag of the residual coefficient encoded before the current residual coefficient is 0, the value of the context index increment is derived as 0; The video encoding method of claim 8 , wherein if a value of the sign flag of the residual coefficient encoded before the current residual coefficient is one, the value of the context index increment is derived as one.

10. 9. The video encoding method of claim 8, wherein the value of the context index increment for the sign flag is derived as one of a plurality of values ​​based on sign flags of a plurality of residual coefficients encoded previously to the current residual coefficient in the current block.

11. 9. The image encoding method of claim 8, wherein if a current sub-block in the current block is not a sub-block encoded in a first order and the current residual coefficient is a residual coefficient encoded first in the current sub-block, the residual coefficient encoded previously to the current residual coefficient is derived as a residual coefficient encoded last in a previously encoded sub-block of the current sub-block.

12. The method of claim 8 , further comprising determining whether the sign flag is to be encoded based on the context model based on whether a transform is applied to the current block.

13. 1. A method for transmitting a bitstream, comprising the steps of: generating a bitstream by a method for encoding a video; transmitting the bitstream; The method of encoding the video includes: deriving a residual sample for a current block; deriving current residual coefficients of the current block based on the residual samples; deriving a context index increment for a sign flag representing a sign of the current residual coefficient; deriving a context index for the sign flag based on the context index increment; encoding the sign flag based on a context model for the sign flag indicated by the context index; generating a bitstream including the sign flag and residual information; the context index increment for the sign flag is derived based on a sign flag of a previously encoded residual coefficient of the current residual coefficient in the current block; A method according to claim 1, wherein the residual information comprises information about absolute values ​​of transform coefficient levels at scanning positions.

Citation Information

Patent Citations

  • Object data processor, object data recording device, data storage medium and data transmission structure

    JP1998304353A

  • Video decoding method and apparatus using context coded sign flag in a video coding system

    JP7626889B2