Method and apparatus for decoding image using residual information in image coding system

By deriving a context model for the sign flag of residual coefficients, the method improves video coding efficiency, addressing the increased data volume of high-resolution images and reducing transmission and storage costs.

JP2026002907APending Publication Date: 2026-01-08LG ELECTRONICS INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2025173576
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2019-02-19
Filing Date
2025-10-15
Publication Date
2026-01-08

AI Technical Summary

Technical Problem

The increasing demand for high-resolution, high-quality images leads to a significant increase in the amount of information to be transmitted, resulting in higher transmission and storage costs, necessitating a more efficient video compression technique.

Method used

A video decoding method that derives a context model for the sign flag of a residual coefficient based on previously decoded coefficients, allowing for improved coding efficiency by reducing the number of bits allocated to the sign flag.

Benefits of technology

This approach enhances the overall efficiency of image/video compression by saving bits allocated to the sign flag and improving residual coding efficiency through correlation-based coding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026002907000001_ABST
    Figure 2026002907000001_ABST
Patent Text Reader

Abstract

To provide a video decoding method performed by a decoding device.SOLUTION: An image decoding method according to the present document includes receiving residual information on a current block, deriving a context model for a sign flag of a current residual coefficient in a current sub-block of the current block, decoding the sign flag based on the context model, deriving the current residual coefficient based on the sign flag, deriving a residual sample based on the current residual coefficient, and generating a reconstructed picture based on the residual sample. The context model for the sign flag may be derived based on a sign flag of a residual coefficient decoded before the current residual coefficient in the current sub-block.SELECTED DRAWING: Figure 10
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This document relates to 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 residual coefficient in a video coding system and coding the sign flag based on the derived context model. [Background technology]

[0002] Recently, demand for high-resolution, high-quality images such as HD (High Definition) images and UHD (Ultra High Definition) images has been 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. Therefore, when transmitting image data using a medium such as an existing wired or wireless broadband line or storing image data using an existing storage medium, transmission costs and storage costs 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 coding residual information by deriving a context model of a sign flag representing the sign of a residual coefficient based on the sign flag of a residual coefficient coded before the residual coefficient. [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 receiving residual information for a current block, deriving a context model for a sign flag of a current residual coefficient in a current sub-block of the current block, decoding the sign flag based on the context model, deriving the current residual coefficient based on the sign flag, deriving residual samples based on the current residual coefficient, and generating a reconstructed picture based on the residual samples, wherein the context model for the sign flag is derived based on sign flags of residual coefficients decoded before the current residual coefficient in the current sub-block.

[0008] According to another embodiment of the present document, there is provided a decoding device for decoding video, comprising: an entropy decoding unit that receives residual information for a current block, derives a context model for a sign flag of a current residual coefficient in a current sub-block of the current block, decodes the sign flag based on the context model, and derives the current residual coefficient based on the sign flag, a transform unit that derives residual samples based on the current residual coefficient, and an adder unit that generates a reconstructed picture based on the residual samples, wherein the context model for the sign flag is derived based on sign flags of residual coefficients decoded before the current residual coefficient in the current sub-block.

[0009] According to yet 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 in a current sub-block of a current block; deriving a context model for a sign flag of the current residual coefficient; encoding the sign flag based on the context model; and generating a bitstream including the sign flag, wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient encoded before the current residual coefficient in the current sub-block.

[0010] According to another embodiment of the present document, there is provided a video encoding apparatus, comprising: a transform unit that derives a current residual coefficient in a current sub-block of a current block; and an entropy encoding unit that derives a context model for a sign flag of the current residual coefficient, encodes the sign flag based on the context model, and generates a bitstream including the sign flag, wherein the context model for the sign flag is derived based on a sign flag of a residual coefficient that is encoded before the current residual coefficient in the current sub-block. [Effects of the Invention]

[0011] According to this document, it is possible to improve the overall efficiency of image / video compression.

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

[0013] According to this document, the sign flag representing the sign of the 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.

[0014] According to this document, a context model for a sign flag representing the sign of a residual coefficient is derived based on the sign flag of a residual coefficient coded before the residual coefficient, and thereby the sign flag is coded 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. [Brief explanation of the drawings]

[0015] [Figure 1] 1 illustrates schematically an example of a video / image coding system to which embodiments of the present document can be applied. [Figure 2] 1 is a diagram illustrating the configuration of a video / image encoding device to which an embodiment of the present document can be applied; [Figure 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] Illustrates an example of CABAC (context-adaptive binary arithmetic coding) for encoding syntax elements. [Figure 5] 1 is a diagram illustrating an example of transform coefficients in a 4x4 block. [Figure 6] An example of determining a coding method for the sign flag based on whether the transformation of the current block is applicable and encoding the same will be described below. [Figure 7] An example of determining a coding method for the sign flag based on whether the transformation of the current block is applicable and decoding the same will be described below. [Figure 8] 1 illustrates a video encoding method using 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 a video decoding method using 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 INVENTION

[0016] This document may be modified in various ways and may have various embodiments. Specific embodiments will be illustrated in the drawings and described in detail. However, this is not intended to limit this document to the specific embodiment. Common terms used in this document are used merely to describe specific embodiments and are not intended to limit the technical ideas of this document. A singular expression includes a plural expression unless the context clearly dictates otherwise. In this specification, terms such as "comprise" or "have" are intended to specify the presence of a feature, number, step, operation, component, part, or combination 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 may be combined to form a single component, or a single component may be divided into multiple components. Embodiments in which each component is integrated and / or separated are also within the scope of this document as long as they do 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 to refer to the same components in the drawings, and duplicated descriptions of the same components may be omitted.

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

[0020] As shown in Figure 1, a 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 file or streaming form via a digital storage medium or a network.

[0021] The source device may include a video source, an encoding device, and a transmitting unit. The receiving device may include a receiving unit, a decoding device, and a renderer. The encoding device may be 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 include a display unit, which may be a separate device or an external component.

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

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

[0024] The transmitter can transmit the encoded video / image information or data output in the form of a bitstream to a receiver of a receiving device via a digital storage medium or a network in the form of a file or streaming. The digital storage medium can include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. The transmitter can include elements for generating a media file in a predetermined file format and elements for transmission via a broadcasting / communication network. The receiver can 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 transform, and prediction, which correspond to the operations of the encoding device.

[0026] The renderer can render the decoded video / image, and the rendered video / image can 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 second generation audio video coding standard (AVS2), or next generation video / image coding standards (e.g., H.267 or H.268).

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

[0029] In this document, video can refer to a collection of a series of images over time. A picture generally refers to a unit that shows one image at a specific time period, and a slice / tile is a unit that constitutes part of a picture in coding. A slice / tile can include one or more coding tree units (CTUs). A picture can be composed of one or more slices / tiles. A picture can be composed of one or more tile groups. A tile group can include one or more tiles. A brick can represent a rectangular region of CTU rows within a tile in a picture. A tile can be partitioned into multiple bricks, each 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 can indicate a specific sequential ordering of CTUs partitioning a picture, where the CTUs can be ordered consecutively in a CTU raster scan within a brick, the bricks within a tile can be ordered consecutively in a raster scan of the bricks of the tile, and the tiles within a picture can be ordered consecutively in a raster scan of the tiles of the picture. A tile is a rectangular region of CTUs within a particular tile column and a particular tile row in a picture. 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 height of the picture. A tile scan can indicate a specific sequential ordering of CTUs partitioning a picture, where the CTUs can be consecutively aligned in a CTU raster scan within a tile, and tiles within a picture can be consecutively aligned in a raster scan of the tiles of the picture. A slice includes an integer number of bricks of a picture that may be 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, in this document, tile group / tile group header may be referred to as slice / slice header.

[0030] A pixel or a pel may refer to the smallest unit constituting one picture (or image). A term corresponding to a pixel may also be used: "sample." A sample may generally refer to a pixel or a pixel value, or 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.

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

[0032] In this document, the terms " / " and "," should be interpreted as "and / or." For example, "A / B" means "A and / or B," and "A, B" means "A and / or B." Additionally, "A / B / C" means "at least one of A, B, and / or C." Also, "A, B, C" means "at least one of A, B, and / or C." (In this document, the terms " / " and "," should be interpreted to indicate "and / or." For instance, the expression "A / B" may mean "A and / or B." Further, "A, B" may mean "A and / or B." Further, "A / B / C" may mean "at least one of A, B, and / or C." Also, "A / B / C" may mean "at least one of A, B, and / or C.")

[0033] Additionally, in this document, the term "or" should be interpreted to mean "and / or." For example, "A or B" can mean 1) only "A," or 2) only "B," or 3) "A and B." Further, in this document, the term "or" should be interpreted to indicate "and / or." For instance, the expression "A or B" may comprise 1) only A, 2) only B, and / or 3) both A and B. In other words, the term "or" in this document should be interpreted to indicate "additionally or alternatively."

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

[0035] As shown in FIG. 2, the encoding apparatus 200 may include an image partitioner 210, a predictor 220, a residual processor 230, an entropy encoder 240, an adder 250, a filter 260, and a memory 270. The predictor 220 may include an inter 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 dividing unit 210, the predicting unit 220, the residual processing unit 230, the entropy encoding unit 240, the adding unit 250, and the filtering unit 260 may be configured as one or more hardware components (e.g., an encoder chipset or a processor) depending on the embodiment. Also, the memory 270 may include a decoded picture buffer (DPB) and may be configured as a digital storage medium. The hardware components may further include the memory 270 as an internal / external component.

[0036] The image division unit 210 may divide an input image (or picture or frame) input to the encoding device 200 into one or more processing units. For example, the processing units may be called coding units (CUs). In this case, the coding units may be recursively divided 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 multiple coding units of deeper depths based on a quad-tree structure, a binary tree structure, and / or a ternary structure. In this case, for example, the quad-tree structure may be applied first, and then the binary tree structure and / or the ternary structure may be applied later. Alternatively, the binary tree structure may be applied first. The coding procedure described herein may be performed based on a final coding unit that is not further divided. In this case, the largest coding unit may be immediately used as the final coding unit based on coding efficiency according to image characteristics, or the coding unit may be recursively divided into coding units of lower depths as needed, and the coding unit of the optimal size may be used as the final coding unit. Here, the coding procedure may include procedures such as prediction, transformation, and restoration, which will be described later. 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 each be divided or partitioned from the final coding unit.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.

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

[0038] The encoding apparatus 200 may subtract 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) to generate a residual signal (residual block, residual sample array), and the generated residual signal is transmitted to the conversion unit 232. In this case, as shown in the figure, a unit in the encoder 200 that subtracts the prediction signal (predicted block, prediction sample array) from the input video signal (original block, original sample array) may be referred to as a subtraction unit 231. The prediction unit may perform prediction on a current block to be processed (hereinafter, referred to as 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 on a current block or CU basis. 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.

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

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

[0041] The predictor 220 may generate a prediction signal based on various prediction methods, which will be described later. For example, the predictor may apply intra prediction or inter prediction for prediction of a block, or may simultaneously apply intra prediction and inter prediction. This may be referred to as combined inter and intra prediction (CIIP). The predictor may also use 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 video / moving video coding, such as games, such as 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, sample values ​​within a picture may be signaled based on information about a palette table and a palette index.

[0042] The prediction signal generated by the prediction unit (including the inter prediction unit 221 and / or the intra prediction unit 222) may be used to generate a reconstructed signal or 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, GBT refers to a transform obtained from a graph representing inter-pixel relationship information. CNT refers to a transform obtained based on a prediction signal generated using all previously reconstructed pixels. The transform process may be applied to pixel blocks having the same square size or non-square blocks of variable size.

[0043] The quantization unit 233 quantizes the transform coefficients and transmits them to the entropy encoding unit 240. The entropy encoding unit 240 encodes the quantized signal (information about the quantized transform coefficients) and outputs it as a bitstream. The information about the quantized transform coefficients may be referred to as residual information. The quantization unit 233 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 about 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), context-adaptive binary arithmetic coding (CABAC), etc. In addition to the quantized transform coefficients, the entropy encoding unit 240 may also 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 units of network abstraction layer (NAL) 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 also 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-described encoding procedure and included in the bitstream. The bitstream may be transmitted via a network or stored on 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.

[0044] The quantized transform coefficients output from the quantization unit 233 may be used to generate a prediction signal. For example, a residual signal (residual block or residual sample) may be reconstructed by applying inverse quantization and inverse transform to the quantized transform coefficients via the inverse quantization unit 234 and the inverse transform unit 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 the reconstructed block. The adder 250 may be referred to as a reconstruction unit or a reconstructed block generator. The generated reconstructed signal may be used for intra prediction of the next block to be processed in the current picture, or may be used for inter prediction of the next picture after filtering, as described below.

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

[0046] The filtering unit 260 may apply filtering to the reconstructed signal to improve subjective / objective image quality. For example, the filtering unit 260 may apply various filtering methods to the reconstructed picture to generate a modified reconstructed picture and store the modified reconstructed picture in the memory 270, specifically, in the DPB of the memory 270. The various filtering methods may include, 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 connection with each filtering method. The filtering information may be encoded by the entropy encoding unit 240 and output in the form of a bitstream.

[0047] The modified reconstructed picture transmitted to the memory 270 can be used as a reference picture in the inter prediction unit 221. When inter prediction is applied through this, the encoding apparatus can avoid prediction mismatch between the encoding apparatus 200 and the decoding apparatus 300 and can also improve coding efficiency.

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

[0049] FIG. 3 is a diagram illustrating the configuration of a video / image decoding device to which the embodiments of this document can be applied.

[0050] As shown in FIG. 3, the decoding device 300 may include an entropy decoder 310, a residual processor 320, a predictor 330, an adder 340, a filter 350, and a memory 360. The predictor 330 may include an inter predictor 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 implemented as a single hardware component (e.g., a decoder chipset or processor) according to an embodiment. The memory 360 may include a decoded picture buffer (DPB) or may be implemented as a digital storage medium. The hardware components may further include a memory 360 as an internal / external component.

[0051] When a bitstream including video / image information is input, the decoding apparatus 300 can reconstruct an image corresponding to the process by which the video / image information was processed by the encoding apparatus of FIG. 2. For example, the decoding apparatus 300 can derive units / blocks based on block division-related information obtained from the bitstream. The decoding apparatus 300 can perform decoding using a processing unit applied by the encoding apparatus. Accordingly, the processing unit for decoding 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. The reconstructed image signal decoded and output by the decoding apparatus 300 can be played back via a playback device.

[0052] 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 parse the bitstream to derive information (e.g., video / video information) necessary for video restoration (or picture restoration). The video / video information may further include information on various parameter sets, such as an adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). The video / video information may also include general constraint information. The decoding apparatus may further decode pictures based on the information on the parameter sets and / or the general constraint information. Signaled / received information and / or syntax elements, which will be described later in this document, may be decoded via the decoding procedure and obtained from the bitstream. For example, the entropy decoding unit 310 may decode information in a bitstream based on a coding method such as Exponential Golomb coding, CAVLC, or CABAC, and output values ​​of syntax elements required for image restoration, 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 the bitstream, determine a context model using information on the syntax element to be decoded and decoding information on neighboring and current blocks, or information on symbols / bins decoded in a previous step, predict the occurrence probability of the bins according to the determined context model, and perform arithmetic decoding of the bins to generate symbols corresponding to the values ​​of each syntax element.In this case, after determining a context model, the CABAC entropy decoding method may update the context model using information on the decoded symbol / bin for the context model of the next symbol / bin. Prediction-related 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). Furthermore, filtering-related 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) that receives a signal output from the encoding apparatus may be further configured as an internal / external element of the decoding apparatus 300, or the receiving unit may be a component of the entropy decoding unit 310. 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.

[0053] 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 format. In this case, the rearrangement may be performed based on the coefficient scanning order performed in the encoding apparatus. The inverse quantization unit 321 may perform inverse quantization on the quantized transform coefficients using a quantization parameter (e.g., quantization step size information) to obtain transform coefficients.

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

[0055] 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 about the prediction output from the entropy decoding unit 310, and may determine a specific intra / inter prediction mode.

[0056] The predictor 320 may generate a prediction signal based on various prediction methods, which will be described later. For example, the predictor may apply intra prediction or inter prediction for predicting a block, or may simultaneously apply intra prediction and inter prediction. This may be referred to as combined inter and intra prediction (CIIP). The predictor may also use intra block copy (IBC) prediction mode or palette mode for predicting a block. The IBC prediction mode or palette mode may be used for content video / moving picture coding, such as games, such as 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. Palette mode may be seen as an example of intra coding or intra prediction. When palette mode is applied, information regarding a palette table and a palette index may be included in the video / picture information and signaled.

[0057] The intra prediction unit 331 may predict a current block by referring to samples in a current picture. The referenced samples may be located adjacent to or distant from the current block depending on the 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 prediction modes applied to neighboring blocks.

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

[0059] The adder 340 may generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the acquired residual signal to a predicted 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 the current block, such as when a skip mode is applied, the predicted block may be used as a reconstructed block.

[0060] 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 the current picture, may be output after filtering as described below, or may be used for inter prediction of a next picture.

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

[0062] 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.

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

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

[0065] 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. 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.

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

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

[0068] The binarized bins of the syntax elements can then be input to a regular encoding engine or a bypass encoding engine. The regular encoding engine of the encoding device can 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 can update the context model for each bin after encoding the bin. A bin encoded as described above can be referred to as a context-coded bin.

[0069] 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 the steps of estimating the probability for the input bin and updating the 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.

[0070] Entropy decoding can refer to the process of performing the same process as the entropy encoding described above in reverse order.

[0071] 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 the block to be decoded or a neighboring block, or information on symbols / bins decoded in a previous step, predict the occurrence probability of the received bin based on the determined context model, and derive the value of the syntax element by performing arithmetic decoding of the bin. Thereafter, the context model of the bin to be decoded next can be updated to the determined context model.

[0072] For example, when a syntax element is bypass-decoded, a decoding device can 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 can omit a procedure for deriving a context model for the syntax element and a procedure for updating the context model applied to the bin after decoding.

[0073] As described above, residual samples may be derived into quantized transform coefficients through a transform and quantization process. 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 it in the form of a bitstream. 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, the position of the last significant transform coefficient in the block, whether significant transform coefficients exist in a sub-block, and the magnitude / sign of the significant transform coefficients, as will be described later.

[0074] 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 shown in the following table.

[0075] [Table 1-1]

[0076] [Table 1-2]

[0077] [Table 1-3]

[0078] [Table 1-4]

[0079] Transform_skip_flag indicates whether transform is skipped for an associated block. The transform_skip_flag may be a syntax element for a transform skip flag. The associated block may be a coding block (CB) or a transform block (TB). The terms CB and TB may be used interchangeably in relation to the transform (and quantization) and residual coding procedures. For example, as described above, residual samples may be derived for a CB, and (quantized) transform coefficients may be derived through transform and quantization of the residual samples. Information (e.g., syntax elements) efficiently representing the positions, magnitudes, signs, etc. of the (quantized) transform coefficients may be generated and signaled through the residual coding procedure. Quantized transform coefficients may be simply referred to as transform coefficients. Generally, 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. 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 referred to as 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 mentioned above, the TB may be used interchangeably with the coding block CB.

[0080] Meanwhile, 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 detailed description of the syntax elements etc. will be provided below.

[0081] Meanwhile, unlike the embodiment in which syntax elements etc. are transmitted, a scheme for signaling tu_mts_idx can be proposed.

[0082] Specifically, the comparison between the scheme for signaling tu_mts_idx in the existing VVC Draft 3 and the proposed scheme for signaling tu_mts_idx can be made as follows.

[0083] [Table 2]

[0084] 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 MTS index is coded. Here, the coding of the MTS index may be performed by fixed-length binarization, and the fixed bit length of the MTS index may be 2.

[0085] 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.

[0086] In the proposed method, the meanings and binary values ​​of the MTS index values ​​can be as follows:

[0087] [Table 3]

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

[0089] Alternatively, another example of the meanings and binary values ​​represented by the MTS index values ​​may be as follows:

[0090] [Table 4]

[0091] For example, if the value of the MTS index is 0, the MTS index may indicate that no transform is 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 indicate that a transform is applied to the current block, no MTS is applied, and the horizontal and vertical transform kernel types are DCT-2. If the value of the MTS index is 2, the MTS index may indicate that a transform and MTS are applied to the current block, and the horizontal and vertical transform kernel types are DST-7. If the value of the MTS index is 3, the MTS index may indicate 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 indicate that a transform and MTS are applied to the current block, and 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 an MTS are applied to the current block, and that the horizontal transform kernel type and the vertical transform kernel type are DCT-8.

[0092] 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.

[0093] [Table 5]

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

[0095] The syntax elements related to the residual data encoding / decoding including the integrated MTS index can be expressed as follows:

[0096] [Table 6-1]

[0097] [Table 6-2]

[0098] [Table 6-3]

[0099] [Table 6-4]

[0100] 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.

[0101] 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 the column position of the last significant coefficient in the scanning order within the transform block, the last_sig_coeff_y_prefix represents a prefix of the row position of the last significant coefficient in the scanning order within the transform block, the last_sig_coeff_x_suffix represents a suffix of the column position of the last significant coefficient in the scanning order within the transform block, and the last_sig_coeff_y_suffix represents a suffix of the row position of the last significant coefficient in the scanning order within the transform block. The significant coefficients may represent the non-zero coefficients. In addition, the scan order may be a right-up 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 the current block (CB, or CB including TB) and / or a specific intra / inter prediction mode.

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

[0103] If the value of coded_sub_block_flag is 0, there is no more information to transmit, and the encoding apparatus can terminate 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. The sub-block containing the last 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 likely to contain non-zero coefficients, coded_sub_block_flag can be assumed to be 1 without being coded.

[0104] If 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 in reverse scanning order. The encoding apparatus may encode a 1-bit syntax element sig_coeff_flag for each transform coefficient in scanning order. If the value of the transform coefficient at the current scanning position is non-zero, the value of sig_coeff_flag may be 1. In the case of a sub-block including the last non-zero coefficient, sig_coeff_flag does not need to be encoded for the last non-zero coefficient, so 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 be an example of a syntax element of a significant coefficient flag indicating whether the quantized transform coefficient is a significant coefficient that is not zero.

[0105] The remaining level value after encoding for sig_coeff_flag can be derived as follows: That is, the syntax element remAbsLevel representing the level value to be encoded can be derived as follows: remAbsLevel = sig_coeff_flag + remAbsLevel + remAbsLevel + remAbsLevel + remAbsLevel

[0106]

number

[0107] Here, coeff means the actual conversion coefficient value.

[0108] 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, which indicates the level value to be coded thereafter, may be derived as follows:

[0109]

number

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

[0111]

number

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

[0113] The transform coefficient level value remAbsLevel to be encoded after par_level_flag encoding can be updated as follows:

[0114]

number

[0115] abs_level_gt3_flag may indicate whether the remAbsLevel at the corresponding scanning position n is greater than 3. Encoding for abs_remainder can 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:

[0116]

number

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

[0118] [Table 7]

[0119] 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.

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

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

[0122] [Table 8]

[0123] Table 9-1

[0124] Table 9-2

[0125] Table 9-3

[0126] Table 9-4

[0127] Table 10-1

[0128] Table 10-2

[0129] Table 10-3

[0130] According to this embodiment, as shown in Table 8, residual coding may be branched depending on the value of the syntax element transform_skip_flag of the transform skip flag. That is, different syntax elements may be used for residual coding depending on the value of the transform skip flag (depending on whether a transform skip is performed). Residual coding used when a transform skip is not applied (i.e., a transform is applied) may be called Regular Residual Coding (RRC), and residual coding used when a transform skip is not applied (i.e., a transform is not applied) may be called Transform Skip Residual Coding (TSRC). Table 9 shows syntax elements for residual coding when the value of transform_skip_flag is 0, i.e., a transform is applied, and Table 10 shows syntax elements for residual coding when the value of transform_skip_flag is 1, i.e., a transform is not applied.

[0131] Specifically, for example, a transform skip flag indicating whether a transform of a transform block is 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, and the residual coefficients may be derived based on the syntax elements, as shown in Table 10. In this case, the syntax elements may be parsed sequentially, or the parsing order may be changed. In addition, 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.

[0132] 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, can be parsed as shown in Table 9, and the residual coefficients can be derived based on the syntax elements. In this case, the syntax elements can be parsed sequentially, and the parsing order can be changed. Also, the abs_level_gtx_flag can represent abs_level_gt1_flag and / or abs_level_gt3_flag. For example, abs_level_gtx_flag[n][0] may be an example of a first transform coefficient level flag (abs_level_gt1_flag), and abs_level_gtx_flag[n][1] may be an example of a second transform coefficient level flag (abs_level_gt3_flag).

[0133] As described above, when comparing syntax elements, etc. for residual coefficients when no transform is applied with syntax elements, etc. for residual coefficients when a transform is applied, the syntax element par_level_flag may not be encoded or decoded. This is because, when the level values ​​of the residual coefficients are large, coding all of the syntax elements, etc., for all residual coefficients, such as sig_coeff_flag, par_level_flag, abs_level_gtx_flag, etc., is likely to transmit overlapping information compared to simply binarizing and transmitting the level values ​​of the residual coefficients. Therefore, in this embodiment, when a transform skip is applied, which may result in large level values ​​of the residual coefficients, the syntax element par_level_flag is omitted, thereby improving coding efficiency.

[0134] On the other hand, CABAC provides high performance but has the disadvantage of poor throughput. This is due to the regular encoding engine of CABAC. Regular encoding (i.e., encoding through the regular encoding engine of CABAC) uses the probability state and range updated by encoding the previous bin, so it exhibits high data dependency and may take a long time to read the probability interval and determine the current state. The throughput issue of CABAC can be resolved by limiting the number of context-coded bins. For example, as shown in Table 1, Table 6, Table 9, or Table 10 above, the total number of bins used to represent sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag can be limited to a number according to the size of the block. For example, if the block is a 4x4 block, the total number of bins for sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag may be limited to 32, and if the block is a 2x2 block, the total number of bins for sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag may be limited to 8. The limited number of bins may be represented by remBinsPass1.

[0135] In this case, if the encoding apparatus uses all of the limited number of context coding bins to encode the context elements, it may perform bypass encoding by binarizing the remaining coefficients using a binarization method for the coefficients described below without using CABAC. In other words, for example, if the number of context coded bins coded for 4x4 CG is 32 or the number of context coded bins coded for 2x2 CG is 8, sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag coded in the further context coding bins may not be encoded, but may be directly encoded to dec_abs_level as shown in Table 8 below.

[0136] [Table 11]

[0137] The |coeff| value can be derived based on dec_abs_level. In this case, the |coeff|, which is a conversion coefficient value, can be derived as follows:

[0138]

number

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

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

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

[0142] For example, the encoding results for the reverse diagonal scanned coefficients of FIG. 5 may be as follows:

[0143] [Table 12]

[0144] In 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 4x4 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, scan_pos may also be referred to as a scan position. For example, scan_pos0 may be referred to as scan position 0.

[0145] 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. Furthermore, the decoding apparatus can decode the syntax element to derive a binarized value (i.e., a binarized bin) of the syntax element, and can debinarize the binarized value to derive the value of the syntax element. The binarization process can be performed using 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), a fixed-length (FL) binarization process, or the like, which will be described later. Also, the inverse binarization 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.

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

[0147] The input of the TR binarization process may be the TR binarization request and the syntax element 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.

[0148] Specifically, for 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.

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

[0150]

number

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

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

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

[0154]

Table 13

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

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

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

[0158]

Equation

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

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

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

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

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

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

[0165] [Table 14]

[0166] The variable codeNum can be derived as follows:

[0167]

number

[0168] 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 most significant bit recorded first.

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

[0170] [Table 15]

[0171] The "prefix" bits may be parsed bits as described above for the leadingZeroBits calculation and may be represented as 0 or 1 in the bit string in Table 15. That is, a bit string shown as 0 or 1 in Table 15 above may represent a prefix bit string. The "suffix" bits may be parsed bits in the codeNum calculation and may be represented as xi in Table 15 above. That is, a bit string shown as xi in Table 15 above may represent a 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.

[0172] The bit string assigned to the codeNum can be as follows:

[0173] [Table 16]

[0174] If the descriptor of a syntax element is ue(v), that is, if the syntax element is coded with ue(v), the value of the syntax element may be the same as codeNum.

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

[0176] 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.

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

[0178] [Table 17]

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

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

[0181] 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. Also, the output of the Limited EGk binarization process may be Limited EGk binarization for the value symbolVal corresponding to the bin string.

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

[0183] [Table 18]

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

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

[0186] FL binarization may be performed using a bit string having a number of bits that is a fixed length of the symbol value symbolVal. Here, 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.

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

[0188]

number

[0189] The indexing of bins for FL binarization may be a method using 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.

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

[0191] The inputs 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). The luma position (x0, y0) may refer to the top left sample of the current luma transform block relative to the top left luma sample of the picture.

[0192] The output of the binarization process for the abs_remainder may be the binarization of the abs_remainder (i.e., the binarized bin string of the abs_remainder). The binarization process may derive an available bin string for the abs_remainder.

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

[0194] For example, when the process of deriving lastAbsRemainder and lastRiceParam for 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.

[0195] Also, if not the above case, i.e., if the process is not called 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 call, 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].

[0196] Then, the 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:

[0197]

number

[0198] 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:

[0199]

number

[0200] Alternatively, for example, the Rice parameter cRiceParam may be determined based on whether a transform skip is performed for the current block. That is, if no transform is applied to the current TB including the current CG, in other words, if a transform skip is applied to the current TB including the current CG, the Rice parameter cRiceParam may be derived to be 1. Alternatively, if a transform is applied to the current TB including the current CG, in other words, if 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].

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

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

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

[0204]

number

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

[0206] If the prefix bin string is identical to a bit string with all bits equal to 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.

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

[0208]

number

[0209] 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.

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

[0211] Inputs to the binarization process for the dec_abs_level may include a binarization request for the 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.

[0212] The 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.

[0213] The Rice parameter cRiceParam for the dec_abs_level[n] can be derived through a Rice parameter derivation process that uses the color 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.

[0214] 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:

[0215]

number

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

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

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

[0219]

number

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

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

[0222] The Rice parameter derivation process for dec_abs_level[n] can be as follows.

[0223] Inputs 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), 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. In addition, an output of the Rice parameter derivation process may be the Rice parameter cRiceParam.

[0224] 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 the transform block having the top left luma position (x0, y0), the variable locSumAbs can be derived as a pseudo code as disclosed in the following table.

[0225] [Table 19]

[0226] The rice parameter cRiceParam can be derived as follows:

[0227] 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.

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

[0229] [Table 20]

[0230] 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.

[0231] Also, referring to Table 20 above, when s is 0 and the locSumAbs is 4 or less, ZeroPos[n] may be set to 0; when s is 0 and the locSumAbs is 5, ZeroPos[n] may be set to 1; when s is 0 and the locSumAbs is 6 or more and 11 or less, ZeroPos[n] may be set to 2; when s is 0 and the locSumAbs is 12 or more and 22 or less, ZeroPos[n] may be set to 4; when s is 0 and the locSumAbs is 23 or more and 27 or less, ZeroPos[n] may be set to 8; and when s is 0 and the locSumAbs is 28 or more, ZeroPos[n] may be set to 16. Also, referring to Table 20 above, when s is 1 and locSumAbs is 3 or less, ZeroPos[n] may be set to 1; when s is 1 and locSumAbs is 4, ZeroPos[n] may be set to 2; when s is 1 and locSumAbs is 5, ZeroPos[n] may be set to 3; when s is 1 and locSumAbs is 6 or more and 8 or less, ZeroPos[n] may be set to 4; when s is 1 and locSumAbs is 9 or more and 11 or less, 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 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 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 s is 2 and locSumAbs is 1 or less, ZeroPos[n] may be set to 1; when s is 2 and locSumAbs is 2 or more and 4 or less, ZeroPos[n] may be set to 2; when s is 2 and locSumAbs is 5, ZeroPos[n] may be set to 3; when s is 2 and locSumAbs is 6 or more and 8 or less, ZeroPos[n] may be set to 4; If s is 2 and the locSumAbs is 9 or greater and 11 or less, the ZeroPos[n] may be set to 6; if s is 2 and the locSumAbs is 12 or greater and 17 or less, the ZeroPos[n] may be set to 8; if s is 2 and the locSumAbs is 18 or greater and 24 or less, the ZeroPos[n] may be set to 12; and if s is 2 and the locSumAbs is 25 or greater, the ZeroPos[n] may be set to 16.

[0232] The suffix value suffixVal of the dec_abs_level[n] can be derived as follows:

[0233]

number

[0234] 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.

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

[0236] Scanning order: For example, the scanning order for sub-blocks within a TB block and residual coefficients within 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 within a TB block and residual coefficients within 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 within a TB block and residual coefficients within 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 within a TB block and residual coefficients within the sub-blocks may be a diagonal scan order scanning from the top left to the bottom right.

[0237] No last non-zero transform coefficient position: The residual signal (i.e., residual sample) reflects the spatial residual after prediction, and since no energy compression is performed by the transform skip, a high probability for a trailing zero or an insignificant level at the bottom right of the transform block may not occur any more. Therefore, in this case, signaling information about 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 referred to as a significant coefficient.

[0238] 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 must be modified as follows:

[0239] Due to quantization, the sequence of insignificant 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 described above, and coded_sub_block_flag can be coded for all sub-blocks.

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

[0241] In addition, the context modeling of coded_sub_block_flag can be changed. For example, the context model index can be calculated by logically separating the coded_sub_block_flag of the sub-block to the left of the current sub-block and the coded_sub_block_flag of the sub-block above the current sub-block, etc.

[0242] 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 can be eliminated depending on the diagonal d of the current transform block. As a result, three context models and a single context model can be set to code sig_coeff_flag.

[0243] 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.

[0244] abs_remainder coding: The empirical distribution of the transform skip residual absolute level still fits a Laplacian or geometric distribution, but there may be greater instability than in the transform coefficient absolute level. In particular, the variance within a window of successive realizations may be higher than the residual absolute level. Therefore, the binarization and context modeling of abs_remainder can be modified as follows:

[0245] For example, a higher cutoff value can be used for binarizing abs_remainder. This can provide higher compression efficiency for the switchover point to Rice code for abs_remainder and dedicated context models for each bin position in coding using sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag. Increasing the cutoff allows for more occurrences of "greater than x" flags (e.g., abs_level_gt5_flag, abs_level_gt7_flag, etc.) before the cutoff is reached. The cutoff can be fixed at 5 (numGtFlags=5).

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

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

[0248] Reduction of Context Coded Bins: The transmission of syntax elements for the first scanning pass, i.e., sig_coeff_flag, abs_level_gt1_flag, and par_level_flag, may remain unchanged. 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 a mode where CCB>k is invalid, where k may be a positive integer. For example, k=2 for regular level coding mode. The above restriction may correspond to a reduction in quantization space.

[0249] The syntax elements associated with the coded residual data after the above modifications are applied can be expressed as follows:

[0250] [Table 21]

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

[0252] For example, the input to 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.

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

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

[0255] [Table 22-1]

[0256] [Table 22-2]

[0257] [Table 22-3]

[0258] The context index for bins in Table 22 that have a value other than "bypass," "terminate," or "na" can be derived as follows:

[0259] The ctxInc for the current bin of the syntax element may be derived from the value specified as the item for the current bin in Table 22. If there are multiple values ​​specified as the item for the current bin, the ctxInc may be derived through the clause disclosed in parentheses around the item. The clause may refer to a clause disclosed in the VVC standard. Then, the variable ctxIdxOffset may be set to the lowest value of ctxIdx according to the current value of initType. The context index (ctxIdx) for the current bin of the syntax element may be set to 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.

[0260] 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, and the context index (ctxIdx) for the current bin can be set to 0. And, bypassFlag can be set to 1.

[0261] 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, and the context index (ctxIdx) for the current bin can be set to 0. Also, bypassFlag can be set to 0.

[0262] 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.

[0263] The steps, such as clauses, for deriving ctxInc for bins that have values ​​other than "bypass," "terminate," or "na" can be as described below.

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

[0265] [Table 23]

[0266] Also, for example, the process of deriving ctxInc according to Section 9.5.4.2.3 can be as shown in the following table.

[0267] [Table 24]

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

[0269] [Table 25]

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

[0271] [Table 26]

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

[0273] [Table 27]

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

[0275] [Table 28]

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

[0277] [Table 29]

[0278] 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 different residual information characteristics from a block subjected to general transform encoding. Therefore, an efficient residual data encoding method for a block not subjected to transform encoding is needed. As described above, a transform skip flag indicating whether 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 transform skip flag has a value of 1, the residual information encoding / decoding method proposed in this document may be performed. If the transform skip flag has a value of 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 (the transform is skipped), the residual information encoding / decoding method in the transform skip mode disclosed in Table 10 or Table 21 may be performed.

[0279] 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 called coefficients or residual coefficients.

[0280] As described in Table 1, Table 6, or Table 9, for residual encoding / decoding, the significance coefficient flag, first transform coefficient level flag, parity level flag, and second transform coefficient level flag may be encoded / decoded, and a syntax element for the remain level value, i.e., abs_remainder or dec_abs_level may be encoded / decoded, followed by encoding / decoding a sign flag for each residual coefficient. 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. The sign flag may be the above-mentioned coeff_sign_flag.

[0281] Meanwhile, the sign flag can also 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, it can be encoded / decoded based on a context model.

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

[0283] 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 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. That is, 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 residual coefficient coded before the residual coefficient in the current sub-block, and coding the sign flag based on the determined context model.

[0284] Unlike the sign flag encoding / decoding disclosed in Table 1, Table 6, or Table 21 within a coefficient group (CG) of a transform block, in this embodiment, the sign flag is context-encoded / decoded to improve compression performance. The CG can also be expressed as a sub-block. Also, while the sign flag encoding / decoding disclosed in Table 21 uses only one context model, this embodiment differs in that it encodes using a context model determined based on the sign flag of a residual coefficient coded before the residual coefficient from among multiple context models.

[0285] According to this embodiment, the sign flag may be coded taking into consideration a 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, this 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 immediately preceding residual coefficient in the coefficient scanning order when encoding / decoding the sign flag of the residual coefficient in the current sub-block. Meanwhile, if a residual coefficient in the current sub-block is coded for the first time among the residual coefficients of the current sub-block, the context model for the sign flag of the residual coefficient may be derived to a predefined context model (e.g., context model 0). The above embodiment may improve compression performance for residual information. Meanwhile, the context model may be indicated based on ctxIdx or ctxInc, and the ctxIdx may be derived based on the ctxInc.

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

[0287] 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. Pseudo codes representing this embodiment may be as shown in the following table.

[0288] [Table 30]

[0289] 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.

[0290] [Table 31]

[0291] The ctxInc derivation process disclosed in Table 31 above can be as follows:

[0292] 1. Input the last sign flag (the sign flag encoded / decoded immediately before the sign flag to be coded).

[0293] 2. The last sign flag is output to ctxInc, i.e., the value of the last sign flag is output to ctxInc.

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

[0295] [Table 32]

[0296] Referring to Table 32 above, the context model for the bin of the syntax element coeff_sign_flag (i.e., sign flag) for the current residual coefficient may be 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 may be determined based on ctxInc, and ctxInc may be derived to 0 if the value of lastcoeffsignflag is 0, or 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 preceding the current residual coefficient according to the coefficient scanning order in the current CG (i.e., current sub-block). Meanwhile, if the current residual coefficient is the first residual coefficient in the current CG, lastcoeffsignflag may be set to 0. That is, the initial value of lastcoeffsignflag may be set to 0.

[0297] That is, according to the embodiment, a context model for the bin of coeff_sign_flag of the current residual coefficient can be adaptively determined based on the value of coeff_sign_flag of the previous residual coefficient of the current residual coefficient in the coefficient scanning order among the residual coefficients in the current CG, and thereby the bin of coeff_sign_flag of the current residual coefficient can be decoded and the value of coeff_sign_flag of the current residual coefficient can be derived. This can take into account the correlation between adjacent residual coefficients, thereby improving coding gain. 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.

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

[0299] Specifically, ctxIdxOffset for the sign flag may be derived as the smallest value among the values ​​that ctxIdx for the sign flag may have. For example, in the above content, ctxIdx (a context model index representing a context model) may be derived as one of 0 (i.e., context model 0) or 1 (i.e., context model 1), so ctxIdxOffset may be derived as 0. Then, ctxIdx for the sign flag may be derived as the sum of ctxIdxOffset and the ctxInc. Since the ctxIdxOffset is derived as 0, ctxIdx for the sign flag may be equal to the ctxInc.

[0300] Meanwhile, the above-described embodiments may be applied to all transform skip blocks. Alternatively, since the sign flag is encoded / decoded only for non-zero residual coefficients, it may be more advantageous to apply the above-described embodiments only when the number of non-zero residual coefficients to be encoded / decoded for the sign flag is equal to or greater than a certain number. Therefore, 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 depending on 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 certain value, the sign flag may be coded based on a context model. If the number of non-zero residual coefficients of the current sub-block is less than a certain value, the sign flag may be bypass-coded. For example, the certain 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 4x4 block, the number of non-zero residual coefficients may be one of 0 to 16, and if the current sub-block is a 2x2 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 the current sub-block has non-zero residual coefficients or the number of non-zero residual coefficients.

[0301] Alternatively, an embodiment may be proposed in which whether to perform context coding / bypass coding of a sign flag is determined 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 ranging from 0 to the number of samples in a current block (a block including a current sub-block), or may be controlled in units of sub-blocks, and may be one of 0 to 16 in the case of a 4×4 sub-block, or 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.

[0302] For example, if the size of the current block is 8x8, 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 4x4, 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.

[0303] Alternatively, an embodiment may be proposed in which whether to perform context coding / bypass coding of a sign flag is determined 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 in the current block (a block including the 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, or 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 and position of the current block or 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.

[0304] For example, if the size of the current block is 8x8 and the current sub-block is the third CG, which is encoded first in the order determined by the diagonal scan, the specific value may be derived to 5. 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. 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 third CG may be the bottom right sub-block. Also, if the size of the current block is 8x8 and the current sub-block is the zeroth CG in the order determined by the diagonal scan, 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 zeroth CG may be the top left sub-block.

[0305] Alternatively, an embodiment may be proposed in which whether to perform context coding / bypass coding of a sign flag is determined based on a specific value derived according to the size of a current block, the position of a 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 ranging from 0 to the number of samples of a current block (a block including a current sub-block), or may be controlled in units of sub-blocks, and may be one of 0 to 16 in the case of a 4×4 sub-block or 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 current sub-block, the position of the current sub-block, and the prediction mode of the current block. 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. 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.

[0306] For example, if the size of the current block is 8x8, the current sub-block is the third CG that is encoded first in the order determined by diagonal scan, and the prediction mode of the current block is intra prediction, the specific value may be derived to 5. 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. 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 third CG may be the bottom right sub-block. Also, if the current sub-block is the zeroth CG in the order determined by diagonal scan, 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 zeroth CG may be the top left sub-block.

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

[0308] FIG. 6 illustrates an example of determining a coding method for the sign flag based on whether the transformation of the current block is applicable, and encoding the result.

[0309] As shown in FIG. 6, the encoding apparatus may determine whether a transformation is applied to the current block (S600).

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

[0311] If no transformation is applied to the current block, the encoding apparatus may bypass encode the sign flag for the current residual coefficient of the current sub-block (S620).

[0312] FIG. 7 illustrates an example of determining a coding method for the sign flag based on whether the transformation of the current block is applicable and decoding the same.

[0313] 7, the decoding device may determine whether a transform is applied to the current block (S700). The decoding device may determine whether a transform is applied to the current block based on a transform skip flag of the current block.

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

[0315] If no transformation is applied to the current block, the decoding apparatus may bypass-decode the sign flag for the current residual coefficient of the current sub-block (S720).

[0316] FIG. 8 schematically illustrates a video encoding method by an encoding apparatus according to the present disclosure. The method disclosed in FIG. 8 may be performed by the encoding apparatus disclosed in FIG. 2. Specifically, for example, step S800 in FIG. 8 may be performed by a residual processing unit of the encoding apparatus, and steps S810 to S830 may be performed by an entropy encoding unit of the encoding apparatus. Also, although not shown, the step of deriving predicted samples may be performed by a prediction unit of the encoding apparatus, the step of deriving residual samples for the current block based on original samples and predicted samples for the current block may be performed by a subtraction unit of the encoding apparatus, and the step of generating reconstructed samples and a reconstructed picture for the current block based on the residual samples and predicted samples for the current block may be performed by an addition unit of the encoding apparatus.

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

[0318] 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.

[0319] If a transform is not applied to the current block, i.e., if a transform is not applied to the residual samples, the encoding apparatus may derive the derived residual samples from the current residual coefficients. If a transform is applied to the current block, i.e., if a transform is applied to the residual samples, the encoding apparatus may derive the current residual coefficients by performing a transform on the derived residual samples. The current residual coefficients may be included in a current sub-block of the current block. The current sub-block may be referred to as a current coefficient group (CG). The size of the current sub-block of the current block may be 4x4 or 2x2. 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.

[0320] Meanwhile, the encoding apparatus may generate and encode a transform skip flag indicating whether 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 a transform is applied to residual coefficients, etc. of the current block. That is, the transform skip flag may indicate whether 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.

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

[0322] 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.

[0323] For example, the context model for the sign flag may be derived based on the sign flag of a residual coefficient encoded before the current residual coefficient in the current sub-block. That is, the context model for the sign flag may be derived based on the sign flag of a residual coefficient encoded (or scanned) before the current residual coefficient in the coefficient scanning order among the residual coefficients in the current sub-block. For example, if the sign flag of the residual coefficient encoded before the current residual coefficient is 0, the value of a context index pointing to a context model for the sign flag of the current residual coefficient may be derived to be 0. If the sign flag of the residual coefficient encoded before the current residual coefficient is 1, the value of a context index pointing to a context model for the sign flag of the current residual coefficient may be derived to be 1. That is, if 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 may be derived to context model 0, and if 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 may be derived to context model 1. On the other hand, if the current residual coefficient is the first residual coefficient to be encoded in the current sub-block, the value of a context index indicating the context model for the sign flag of the current residual coefficient may be derived to 0. That is, if the current residual coefficient is the first residual coefficient to be encoded in the current sub-block, the context model for the sign flag of the current residual coefficient may be derived to context model 0.

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

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

[0326] 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 residual coefficients of the current block. The residual information for the current block may include the transform skip flag. If the transform skip flag has a value of 0, the sign flag may not be encoded based on the context model (i.e., the sign flag may be bypass encoded). If the transform skip flag has a value of 1, the sign flag may be encoded based on the context model. That is, if the transform skip flag has a value of 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.

[0327] Alternatively, for example, the encoding apparatus may compare the number of non-zero residual coefficients, etc. in the current sub-block with a specific value to determine whether the sign flag is encoded based on the context model. If the number of non-zero residual coefficients is less than the specific value, the sign flag may not be encoded based on the context model (i.e., the sign flag may be bypass encoded). If the number of non-zero residual coefficients is equal to or greater than the specific value, the sign flag may be encoded based on the context model. In other words, if the number of non-zero residual coefficients, etc. is equal to or greater than the specific value, the encoding apparatus may determine that the sign flag is encoded based on the context model, derive the context model for the sign flag, and encode the sign flag based on the context model. The specific value may also be expressed as a threshold.

[0328] 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 4x4, the specific value may be one of 0 to 16, and if the size of the current sub-block is 2x2, the specific value may be one of 0 to 4. As an example, the specific value may be 5.

[0329] Alternatively, for 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 8x8, the specific value may be derived to be 5, and if the size of the current block is 4x4, the specific value may be derived to be 4.

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

[0331] For example, if the size of the current block is 8x8 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.

[0332] Also, for example, if the size of the current block is 8x8 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.

[0333] Alternatively, for 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 the prediction mode of the current block.

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

[0335] Also, for example, if the size of the current block is the 8x8 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 8x8 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.

[0336] The encoding apparatus encodes the sign flag based on the context model (S820). The encoding apparatus may encode the sign flag based on the context model. That is, the encoding apparatus may encode the sign flag in a context-based manner based on the context model. The sign flag may represent the sign of the current residual coefficient. When the value of the sign flag is 0, the sign flag may represent that the current residual coefficient is a positive value. When the value of the sign flag is 1, the sign flag may represent that the current residual coefficient is a negative value. 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.

[0337] In addition, the encoding apparatus may encode residual information for the current block.

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

[0339] 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.

[0340] 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.

[0341] For example, the residual information may include position information indicating the position of the last non-zero residual coefficient in the residual coefficient array of the current block. That is, the residual information may include position information indicating the position of the last non-zero residual coefficient in the scanning order of the current block. The position information may include information indicating a prefix of the column position of the last non-zero residual coefficient, information indicating a prefix of the row position of the last non-zero residual coefficient, information indicating a suffix of the column position of the last non-zero residual coefficient, and information indicating a suffix of the 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, a non-zero residual coefficient may also be called a significant coefficient.

[0342] For example, the residual information may include syntax elements coded based on the context of a current residual coefficient in a current sub-block of the current block. The syntax elements may include a significant coefficient flag indicating whether the current residual coefficient is a non-zero residual coefficient, a parity level flag indicating the parity of a coefficient level for the current residual coefficient, a first coefficient level flag indicating whether the coefficient level is greater than a first threshold, and a second coefficient level flag indicating whether the coefficient level of the current residual coefficient is greater than a second threshold. 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.

[0343] 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 transform is applied to the current block (i.e., when the value of a transform skip flag is 1), the context-based coded syntax elements may include the sign flag. That is, when no transform is applied to the current block (i.e., when the value of a transform skip flag is 1), the sign flag may be encoded based on a context model.

[0344] Also, for example, the residual information may include a syntax element coded on a bypass basis for a current residual coefficient in the current sub-block of the current block. The bypass-coded syntax element may include 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 transform skip flag has a value of 0), the bypass-coded syntax element may include the sign flag. That is, if a transform is applied to the current block (i.e., if a transform skip flag has a value of 0), the sign flag may be bypass-encoded (i.e., the sign flag may be encoded based on a uniform probability distribution).

[0345] The encoding apparatus generates a bitstream including the sign flag (S830). For example, the encoding apparatus may output video information including residual information including the sign flag as a bitstream. The bitstream may include the residual information.

[0346] 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.

[0347] 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.

[0348] FIG. 9 schematically illustrates an encoding apparatus for performing the 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, a residual processing unit of the encoding apparatus of FIG. 9 may perform S800 of FIG. 8, and an entropy encoding unit of the encoding apparatus of FIG. 9 may perform S810 to S830 of FIG. 8. Also, although not shown, a process of deriving a prediction sample may be performed by a prediction unit of the encoding apparatus, a process of deriving a reconstructed sample for the current block based on the residual sample and the prediction sample for the current block may be performed by an adder of the encoding apparatus, and a process of encoding prediction information for the current block may be performed by an entropy encoding unit of the encoding apparatus.

[0349] Figure 10 schematically illustrates 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, steps S1000 to S1030 in Figure 10 may be performed by an entropy decoding unit of the decoding device, step S1040 may be performed by a residual processing unit of the decoding device, and step S1050 may be performed by an adder of the decoding device. Also, although not shown, the process of deriving predicted samples may be performed by a prediction unit of the decoding device.

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

[0351] 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.

[0352] 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.

[0353] For example, the residual information may include position information indicating the position of the last non-zero residual coefficient in the residual coefficient array of the current block. That is, the residual information may include position information indicating the position of the last non-zero residual coefficient in the scanning order of the current block. The position information may include information indicating a prefix of the column position of the last non-zero residual coefficient, information indicating a prefix of the row position of the last non-zero residual coefficient, information indicating a suffix of the column position of the last non-zero residual coefficient, and information indicating a suffix of the 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, a non-zero residual coefficient may also be called a significant coefficient.

[0354] For example, the residual information may include syntax elements coded based on the context for a current residual coefficient in a current sub-block of the current block. The syntax elements may include a significant coefficient flag indicating whether the current residual coefficient is a non-zero residual coefficient, a parity level flag indicating the parity of a coefficient level for the current residual coefficient, a first coefficient level flag indicating whether the coefficient level is greater than a first threshold, and a second coefficient level flag indicating whether the coefficient level of the current residual coefficient is greater than a second threshold. 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.

[0355] 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 transform is applied to the current block (i.e., when the value of a transform skip flag is 1), the context-based coded syntax elements may include the sign flag. That is, when no transform is applied to the current block (i.e., when the value of a transform skip flag is 1), the sign flag may be decoded based on a context model.

[0356] Also, for example, the residual information may include a syntax element coded on a bypass basis for a current residual coefficient in the current sub-block of the current block. The bypass-coded syntax element may include coefficient value-related information for the 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 transform skip flag has a value of 0), the bypass-coded syntax element may include the sign flag. That is, if a transform is applied to the current block (i.e., if a transform skip flag has a value of 0), the sign flag may be bypass-decoded (i.e., the sign flag may be decoded based on a uniform probability distribution).

[0357] Meanwhile, the bitstream may include prediction information for the current block. The prediction information may include information about an inter-prediction mode or an intra-prediction mode to be performed on the current block. A decoding device may perform inter-prediction or intra-prediction on the current block based on the prediction information received through the bitstream and derive prediction samples, etc., of the current block.

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

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

[0360] For example, the context model for the sign flag may be derived based on the sign flag of a residual coefficient decoded before the current residual coefficient in the current sub-block. That is, the context model for the sign flag may be derived based on the sign flag of a residual coefficient decoded (or scanned) before the current residual coefficient in a coefficient scanning order among the residual coefficients in the current sub-block. For example, if the sign flag of the residual coefficient decoded before the current residual coefficient is 0, the value of a context index pointing to a context model for the sign flag of the current residual coefficient may be derived to be 0, and if the sign flag of the residual coefficient decoded before the current residual coefficient is 1, the value of a context index pointing to a context model for the sign flag of the current residual coefficient may be derived to be 1. That is, if 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 may be derived to context model 0, and if 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 may be derived to context model 1. On the other hand, if the current residual coefficient is the first residual coefficient to be decoded in the current sub-block, the value of a context index indicating the context model for the sign flag of the current residual coefficient may be derived to 0. That is, if the current residual coefficient is the first residual coefficient to be decoded in the current sub-block, the context model for the sign flag of the current residual coefficient may be derived to context model 0.

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

[0362] 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.

[0363] For example, the decoding device 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 device 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 of the current block. The residual information for the current block may include the transform skip flag. If the transform skip flag has a value of 0, the sign flag may not be decoded based on the context model (i.e., the sign flag may be bypass decoded). If the transform skip flag has a value of 1, the sign flag may be decoded based on the context model. That is, if the transform skip flag has a value of 1, it may be determined that the sign flag is decoded based on the context model, and the decoding device may derive the context model for the sign flag and decode the sign flag based on the context model.

[0364] Alternatively, for example, the decoding device may compare the number of non-zero residual coefficients, etc. in the current sub-block with a specific value to determine whether the sign flag is to be decoded based on the context model. If the number of non-zero residual coefficients, etc. is smaller than the specific value, the sign flag may not be decoded based on the context model (i.e., the sign flag may be bypass decoded). If the number of non-zero residual coefficients, etc. 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 non-zero residual coefficients, etc. is equal to or greater than the specific value, the decoding device may determine that the sign flag is to be decoded based on the context model, derive the context model for the sign flag, and decode the sign flag based on the context model. The specific value may also be expressed as a threshold.

[0365] 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 4x4, the specific value may be one of 0 to 16, and if the size of the current sub-block is 2x2, the specific value may be one of 0 to 4. As an example, the specific value may be 5.

[0366] Alternatively, for 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 8x8, the specific value may be derived to be 5, and if the size of the current block is 4x4, the specific value may be derived to be 4.

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

[0368] For example, if the size of the current block is 8x8 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.

[0369] Also, for example, if the size of the current block is 8x8 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.

[0370] Alternatively, for 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 the prediction mode of the current block.

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

[0372] Also, for example, if the size of the current block is the 8x8 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 8x8 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.

[0373] The decoding device decodes the sign flag based on the context model (S1020). The decoding device can decode the sign flag based on the context model. The sign flag can represent the sign of the current residual coefficient. When the value of the sign flag is 0, the sign flag can represent that the current residual coefficient is a positive value, and when the value of the sign flag is 1, the sign flag can represent that the current residual coefficient is a negative value. That is, when the value of the sign flag is 0, the current residual coefficient can be a positive value, and when the value of the sign flag is 1, the current residual coefficient can be a negative value.

[0374] The decoding device derives the current residual coefficient based on the sign flag (S1030). The decoding device can derive the magnitude (i.e., level value) of the current residual coefficient based on the residual information (e.g., magnitude-related information for the current residual coefficient), and can derive the current residual coefficient in the current sub-block using the sign of the current residual coefficient and the magnitude of the current residual coefficient derived based on the sign flag. That is, the decoding device can derive the current residual coefficient in the current sub-block based on the sign flag for the current residual coefficient and the residual information (e.g., syntax elements for the current residual coefficient).

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

[0376] The decoding device may derive residual samples of the current block based on the current residual coefficients. That is, the decoding device may derive residual samples in the current sub-block of the current block based on the current residual coefficients. 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 device may derive the current residual coefficients from the residual samples of the current block. Alternatively, 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 device may dequantize the current residual coefficients to derive the residual samples of the current block. Alternatively, 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 device may inverse transform the current residual coefficients to derive the residual samples 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 can dequantize the current residual coefficients and inverse transform the dequantized coefficients to derive the residual samples of the current block.

[0377] The decoding device generates a reconstructed picture based on the residual samples (S1050).

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

[0379] As mentioned above, in-loop filtering procedures such as deblocking filtering, SAO and / or ALF procedures may then be applied to the reconstructed pictures to improve the subjective / objective image quality as needed.

[0380] Figure 11 schematically illustrates a decoding device that performs the 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, the entropy decoding unit of the decoding device of Figure 11 can perform steps S1000 to S1030 of Figure 10, the residual processing unit of the decoding device of Figure 11 can perform step S1040 of Figure 10, and the adder of the decoding device of Figure 11 can perform step S1050 of Figure 10. Also, although not shown, the process of deriving predicted samples can be performed by a prediction unit of the decoding device of Figure 11.

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

[0382] In addition, according to this document, the sign flag representing the sign of the 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.

[0383] 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 sign flag of a residual coefficient coded before the residual coefficient, and thereby the sign flag is coded taking into consideration the correlation between adjacent residual coefficients, thereby saving the amount of bits allocated to the sign flag and improving the overall residual coding efficiency.

[0384] In the above-described embodiments, the method is described based on a flow chart as a series of steps or blocks, but this document is not limited to the order of steps, and some steps may occur in a different order or simultaneously with other steps than those described above. Furthermore, those skilled in the art will understand that the steps shown in the 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.

[0385] The embodiments described herein 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.

[0386] In addition, the decoding device and encoding device to which the embodiments of this document are applied may be included in a multimedia broadcast transmitting / receiving device, a mobile communication terminal, a home cinema video device, a digital cinema video device, a surveillance camera, a video interaction device, a real-time communication device such as video communication, a mobile streaming device, a storage medium, a camcorder, a custom video (VoD) service providing device, an over-the-top (OTT) video (over-the-top) device, an internet streaming service providing device, a three-dimensional (3D) video device, an image telephone video device, a vehicle terminal (e.g., a vehicle terminal, an airplane terminal, a ship terminal, etc.), a medical video device, etc., and may be used to process video signals or data signals. For example, an over-the-top (OTT) video (over-the-top) 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.

[0387] In addition, a processing method to which an embodiment of this document is applied may be produced in the form of a computer-executable program and 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 types 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 media embodied in the form of a carrier wave (e.g., transmission via the Internet). In addition, a bitstream generated by an encoding method may be stored in a computer-readable recording medium or transmitted via a wired or wireless communication network.

[0388] Furthermore, the embodiments of the present document may be embodied in a computer program product with program code, which may be executed by a computer in accordance with the embodiments of the present document. The program code may be stored on a computer-readable carrier.

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

[0390] 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.

[0391] 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.

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

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

[0394] The streaming server can receive content from a media repository and / or an encoding server. For example, if 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.

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

Claims

1. A video decoding method performed by a decoding device, receiving residual information for a current block; deriving a context index increment for a sign flag of a current residual coefficient in a current sub-block of the current block; decoding the sign flag based on the context index increment; deriving the 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; determining whether the current block is a transform skip block; based on the current block being the transform skip block, sign flags of residual coefficients of the current block including the current residual coefficient are decoded in a context-based manner; the context index increment for the sign flag is derived based on a sign level of a residual coefficient prior to the current residual coefficient in the current sub-block; The video decoding method, wherein the value of the context index increment is derived as 0 based on the absence of the residual coefficient before the current residual coefficient in the current sub-block.

2. based on the presence of the residual coefficient before the current residual coefficient in the current sub-block, (a) if the value of the sign level of the residual coefficient prior to the current residual coefficient is 0, the value of the context index increment for the sign flag of the current residual coefficient is derived as 0; 2. The video decoding method of claim 1, wherein (b) if the value of the sign level of the residual coefficient before the current residual coefficient is 1, the value of the context index increment for the sign flag of the current residual coefficient is derived as 1.

3. 2. The video decoding method of claim 1, wherein the context index increment for the sign flag is derived as one of a plurality of context index increments based on sign levels of a plurality of residual coefficients preceding the current residual coefficient in the current sub-block.

4. A video encoding method performed by an encoding device, deriving current residual coefficients in a current sub-block of a current block; deriving a context index increment for a sign flag of the current residual coefficient; encoding the sign flag based on the context index increment; generating a bitstream including the sign flag; determining whether the current block is a transform skip block; based on the current block being the transform skip block, sign flags of residual coefficients of the current block including the current residual coefficient are context-based encoded; the context index increment for the sign flag is derived based on a sign level of a residual coefficient prior to the current residual coefficient in the current sub-block; The video encoding method, wherein the value of the context index increment is derived as 0 based on the absence of the residual coefficient before the current residual coefficient in the current sub-block.

5. based on the presence of the residual coefficient before the current residual coefficient in the current sub-block, (a) if the value of the sign level of the residual coefficient prior to the current residual coefficient is 0, the value of the context index increment for the sign flag of the current residual coefficient is derived as 0; 5. The video encoding method of claim 4, wherein (b) if the value of the sign level of the residual coefficient before the current residual coefficient is 1, the value of the context index increment for the sign flag of the current residual coefficient is derived as 1.

6. A method for transmitting data relating to video, comprising: obtaining a bitstream of video information including a sign flag of a current residual coefficient in a current sub-block of a current block; transmitting the data including the bitstream of the video information including the sign flag; determining whether the current block is a transform skip block; based on the current block being the transform skip block, sign flags of residual coefficients of the current block including the current residual coefficient are context-based encoded; The sign flag is deriving the current residual coefficients in the current sub-block of the current block; deriving a context index increment for the sign flag of the current residual coefficient; encoding the sign flag based on the context index increment; the context index increment for the sign flag is derived based on a sign level of a residual coefficient prior to the current residual coefficient in the current sub-block; The method of claim 1, wherein the value of the context index increment is derived as 0 based on the absence of the residual coefficient before the current residual coefficient in the current sub-block.

Citation Information

Patent Citations

  • Cross-component prediction for video coding and clipping for adaptive color conversion

    JP2018507622A

  • Sign coding for blocks with transform skipped

    US20150103918A1