Image decoding method using residual information in image encoding system and apparatus therefor

By limiting the number of context compilation bins for transform coefficients in the residual information, the image decoding and encoding process is optimized, solving the problem of high transmission and storage costs for high-resolution, high-quality images and achieving more efficient image compression.

CN117915089BActive Publication Date: 2025-12-09GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410001985.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2019-01-12
Filing Date
2020-01-13
Publication Date
2025-12-09
Estimated Expiration
2040-01-13

AI Technical Summary

Technical Problem

The transmission and storage costs of high-resolution, high-quality images are high, necessitating improvements in image compilation efficiency, particularly residual compilation efficiency.

Method used

The image decoding and encoding process is optimized by limiting the number of context compilation bins for transform coefficients in the residual information and by bypassing syntax elements when a certain number is reached.

Benefits of technology

It improves overall image compression efficiency, reduces residual compilation complexity, and enhances compilation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117915089B_ABST
    Figure CN117915089B_ABST
Patent Text Reader

Abstract

The present invention relates to an image decoding method using residual information in an image encoding system and an apparatus therefor. According to the present document, an image decoding method performed by a decoding apparatus includes the steps of receiving a bitstream including residual information of a current block; deriving a particular number of context-coded bins for a context syntax element of a current sub-block of the current block; decoding the context syntax element of the current sub-block included in the residual information based on the particular number; deriving transform coefficients of the current sub-block based on the decoded context syntax element; deriving residual samples of the current block based on the transform coefficients; and generating a reconstructed picture based on the residual samples.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the patent application with the application number 202080013196.1 (PCT / KR2020 / 000621) filed in the Chinese Patent Office on August 6, 2021, with the international application date of January 13, 2020, the title of which is "Image decoding method using residual information in image encoding system and apparatus therefor". TECHNICAL FIELD

[0002] The present disclosure relates to an image encoding technology, and more particularly, to an image decoding method and apparatus for encoding residual information of a syntax element of a transform coefficient including a residual in an image encoding system. BACKGROUND

[0003] Recently, in various fields, the demand for high-resolution, high-quality images such as HD (High Definition) images and UHD (Ultra High Definition) images is increasing. Because image data has high resolution and high quality, the amount of information or bits to be transmitted increases relative to conventional image data. Therefore, when transmitting image data using a medium such as a conventional wired / wireless broadband line or storing image data using an existing storage medium, the transmission cost and storage cost thereof increase.

[0004] Therefore, there is a need for an efficient image compression technology for efficiently transmitting, storing, and reproducing information of a high-resolution, high-quality image. SUMMARY

[0005] TECHNICAL PROBLEM

[0006] The present disclosure provides a method and apparatus for improving image encoding efficiency.

[0007] The present disclosure also provides a method and apparatus for improving the efficiency of residual encoding.

[0008] The present disclosure also provides a method and apparatus for determining and adjusting the sum of the number of context-coded bins of a context syntax element when adjusting the number of context-coded bins of the context syntax element regarding a current sub-block when encoding residual information.

[0009] TECHNICAL SOLUTION

[0010] In one aspect, an image decoding method performed by a decoding device is provided. The method includes receiving a bitstream including residual information of a current block, deriving a particular number of context-coded bins of a context syntax element about a current sub-block of the current block, decoding the context syntax element about the current sub-block included in the residual information based on the particular number, deriving transform coefficients of the current sub-block based on the decoded context syntax element, deriving residual samples of the current block based on the transform coefficients, and generating a reconstructed picture based on the residual samples, wherein a bypass syntax element of a particular transform coefficient included in the residual information is decoded when a number of context-coded bins of context syntax elements of transform coefficients derived before the particular transform coefficient of the current sub-block reaches the particular number.

[0011] In another aspect, a decoding device for performing image decoding is provided. The decoding device includes an entropy decoder configured to receive a bitstream including residual information of a current block, derive a particular number of context-coded bins of a context syntax element about a current sub-block of the current block, decode the context syntax element about the current sub-block included in the residual information based on the particular number, and derive transform coefficients of the current sub-block based on the decoded context syntax element, an inverse transformer configured to derive residual samples of the current block based on the transform coefficients, and an adder configured to generate a reconstructed picture based on the residual samples of the current block, wherein a bypass syntax element of a particular transform coefficient included in the residual information is decoded when a number of context-coded bins of context syntax elements of transform coefficients derived before the particular transform coefficient of the current sub-block reaches the particular number.

[0012] In another aspect, an image encoding method performed by an encoding device is provided. The method includes deriving residual samples of a current block, deriving transform coefficients in a current sub-block of the current block based on the residual samples, deriving a particular number of context-coded bins of a context syntax element about the current sub-block, encoding the context syntax element based on the particular number, and generating a bitstream including residual information of the current block, the residual information of the current block including the encoded context syntax element, wherein a bypass syntax element of a particular transform coefficient included in the residual information is encoded when a number of context-coded bins of context syntax elements of transform coefficients derived before the particular transform coefficient of the current sub-block reaches the particular number.

[0013] In another aspect, a video encoding apparatus is provided. The encoding apparatus includes a subtractor configured to derive a residual sample with respect to a current block; a transformer configured to derive a transform coefficient in a current sub-block of the current block based on the residual sample; an entropy encoder configured to derive a particular number of context-coded bins of a context syntax element with respect to the current sub-block, encode the context syntax element based on the particular number, and generate a bitstream including residual information of the current block, the residual information of the current block including the encoded context syntax element, wherein a bypass syntax element of a particular transform coefficient included in the residual information is encoded when a number of context-coded bins of context syntax elements of transform coefficients derived before the particular transform coefficient of the current sub-block reaches the particular number.

[0014] Advantageous Effects

[0015] According to this document, overall image / video compression efficiency can be improved.

[0016] According to this document, residual coding efficiency can be improved.

[0017] According to this document, context-coded data can be reduced by limiting a sum of numbers of context-coded bins of context syntax elements with respect to transform coefficients in a current block included in residual information to a predetermined maximum or less.

[0018] According to this document, when adjusting the number of context-coded bins with respect to a current sub-block, instead of determining encoding for each context syntax element, a sum of numbers of context-coded bins of the context syntax elements is determined, whereby residual coding complexity can be reduced and overall coding efficiency can be improved. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 A video / image coding apparatus to which embodiments of the present document can be applied is briefly illustrated.

[0020] Figure 2 is a schematic diagram illustrating a configuration of a video / image encoding apparatus to which embodiments of the present document can be applied.

[0021] Figure 3 is a schematic diagram illustrating a configuration of a video / image decoding apparatus to which embodiments of the present document can be applied.

[0022] Figure 4 Context Adaptive Binary Arithmetic Coding (CABAC) for encoding a syntax element is exemplarily shown.

[0023] Figure 5 is a diagram showing exemplary transform coefficients within a 4x4 block.

[0024] Figure 6 A decoding device performing a method for delivering a residual signal in a pixel domain according to the present disclosure is exemplified.

[0025] Figure 7a and Figure 7b Embodiments for determining whether to parse a transform skip flag based on a number of samples of a current block and a decoding device performing the same are exemplified.

[0026] Figure 8 Residual coefficients of a current block to which a rotation 180 degree re-arrangement method is applied are exemplarily shown.

[0027] Figure 9 Residual coefficients of a current block to which a mirror re-arrangement method is applied are exemplarily shown.

[0028] Figure 10 Residual coefficients of a current block to which a flip re-arrangement method is applied are exemplarily shown.

[0029] Figure 11 Residual coefficients of a current block to which an embodiment in which layers distinguished based on a distance from a reference sample are derived and re-arranged in positions according to an inverse raster scan order is applied are exemplarily shown.

[0030] Figure 12 Residual coefficients of a current block to which an embodiment in which layers distinguished based on a distance from a reference sample are derived and re-arranged in positions according to a diagonal scan order is applied are exemplarily shown.

[0031] Figure 13 Residual coefficients of a current block to which an embodiment in which layers distinguished based on a distance from a specific reference sample are derived and re-arranged in positions according to a diagonal scan order is applied are exemplarily shown.

[0032] Figure 14a and Figure 14b Embodiments for determining whether to apply a re-arrangement method based on a transform skip flag of a current block and an encoding device and a decoding device performing the same are shown.

[0033] Figure 15 Examples of a method for compiling residual information based on a transform skip flag are shown.

[0034] Figure 16 Examples of a method for compiling residual information based on integrated transform type information are shown.

[0035] Figure 17 A method of image encoding by an encoding device according to the present document is schematically shown.

[0036] Figure 18 An encoding apparatus for performing an image encoding method according to the document is schematically shown.

[0037] Figure 19 An image decoding method by a decoding apparatus according to the document is schematically shown.

[0038] Figure 20 A decoding apparatus for performing an image decoding method according to the document is schematically shown.

[0039] Figure 21 A configuration diagram of a content streaming system to which the disclosure is applied is exemplified. DETAILED DESCRIPTION

[0040] The disclosure can be modified in various forms, and specific embodiments thereof will be described and exemplified in the drawings. However, the embodiments are not intended to limit the disclosure. The terms used in the following description are used to describe only specific embodiments and are not intended to limit the disclosure. The expression of the singular includes the expression of the plural unless clearly understood in a different way. Terms such as "include" and "have" are intended to indicate the presence of features, numbers, steps, operations, elements, components, or combinations thereof described in the following description, and should be understood as not excluding the possibility of the presence or addition of one or more different features, numbers, steps, operations, elements, components, or combinations thereof.

[0041] In addition, the elements in the drawings described in the disclosure are independently drawn for the convenience of explaining different specific functions, and do not mean that the elements are embodied by independent hardware or independent software. For example, two or more of the elements can be combined to form a single element, or one element can be divided into a plurality of elements. Embodiments in which the elements are combined and / or divided belong to the disclosure without departing from the concept of the disclosure.

[0042] Hereinafter, embodiments of the disclosure will be described in detail with reference to the accompanying drawings. In addition, in the entire drawings, like reference numerals are used to refer to like elements, and the same description of the like elements will be omitted.

[0043] Figure 1 A brief example of a video / image encoding apparatus to which embodiments of the disclosure can be applied is exemplified.

[0044] REFERENCE Figure 1 A video / image encoding system can include a first apparatus (a source apparatus) and a second apparatus (a receiving apparatus). The source apparatus can transmit encoded video / image information or data in the form of a file or a stream to the receiving apparatus via a digital storage medium or a network.

[0045] The source device can include a video source, an encoding apparatus, and a transmitter. The reception device can include a receiver, a decoding apparatus, and a renderer. The encoding apparatus can be referred to as a video / image encoding apparatus, and the decoding apparatus can be referred to as a video / image decoding apparatus. The transmitter can be included in the encoding apparatus. The receiver can be included in the decoding apparatus. The renderer can include a display, and the display can be configured as a separate device or an external component.

[0046] The video source can acquire a video / image through a process of capturing, synthesizing, or generating a video / image. The video source can include a video / image capturing device and / or a video / image generating device. The video / image capturing device can include, for example, one or more cameras, a video / image archive including previously captured video / images, or the like. The video / image generating device can include, for example, a computer, a tablet, and a smartphone, and can (electronically) generate a video / image. For example, a virtual video / image can be generated through a computer or the like. In this case, the video / image capturing process can be replaced by a process of generating related data.

[0047] The encoding apparatus can encode an input video / image. The encoding apparatus can perform a series of processes such as prediction, transformation, and quantization to achieve compression and coding efficiency. The encoded image / image information or data output in the form of a bitstream can be transmitted to the receiver of the reception device in the form of a file or a stream through a digital storage medium or a network.

[0048] The transmitter can transmit the encoded image / image information or data output in the form of a bitstream to the receiver of the reception device in the form of a file or a stream through a digital storage medium or a network. The digital storage medium can include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, or the like. The transmitter can include an element for generating a media file through a predetermined file format, and can include an element for transmission through a broadcasting / communication network. The receiver can receive / extract the bitstream and transmit the received bitstream to the decoding apparatus.

[0049] The decoding apparatus can decode a video / image by performing a series of processes such as dequantization, inverse transformation, and prediction corresponding to the operations of the encoding apparatus.

[0050] The renderer can render the decoded video / image. The rendered video / image can be displayed through a display.

[0051] 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), EVC (Elementary Video Coding) standard, AOMedia Video 1 (AV1) standard, 2nd generation Audio Video Coding standard (AVS2), or a next-generation video / image coding standard (e.g., H.267, or H.268, or the like).

[0052] This document presents various embodiments of video / image encoding, and the embodiments can be performed in combination with each other unless otherwise mentioned.

[0053] In this document, a video can refer to a series of images over a period of time. A picture generally refers to a unit representing an image at a specific time region, and a slice / tile is a unit that constitutes a part of a picture in encoding. A slice / tile can include one or more coding tree units (CTUs). A picture can include one or more slices / tiles. A picture can include 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 including one or more CTU rows within the tile. A tile that is not partitioned into multiple bricks can also be referred to as a brick. Brick scanning refers to a specific order of CTUs that partitions a picture in which the CTUs are sequentially ordered in a CTU raster scan of bricks, the bricks within a tile are sequentially arranged in a brick raster scan of the tile, and the tiles in a picture are sequentially ordered in a tile raster scan of the picture. A tile is a rectangular region of CTUs within a specific tile column and a specific tile row in a picture. A tile column is a rectangular region of CTUs with a height equal to the height of a picture and a width specified by a syntax element in a picture parameter set. A tile row is a rectangular region of CTUs with a height specified by a syntax element in a picture parameter set and a width equal to the picture width. Tile scanning refers to a specific order of CTUs that partitions a picture in which the CTUs are sequentially ordered in a CTU raster scan of tiles, and the tiles in a picture are sequentially ordered in a tile raster scan of the picture. A slice includes an integer number of bricks of a picture that can be uniquely contained in a single NAL unit. A slice can include multiple complete tiles or only a consecutive sequence of complete bricks of one tile. Tile groups and slices can be used interchangeably in this document. For example, tile group / tile group header can be referred to as slice / slice header in this document.

[0054] A pixel or a pel can represent a minimum unit constituting a picture (or an image). In addition, a "sample" can be used as a term corresponding to a pixel. A sample can generally represent a pixel or a pixel value, and can represent only a pixel / pixel value of a luma component or only a pixel / pixel value of a chroma component.

[0055] A unit can represent a basic unit of image processing. A unit can include at least one of a certain region of a picture and information related to the region. One unit can include one luma block and two chroma (e.g., cb, cr) blocks. In some cases, a unit can be used interchangeably with terms such as a block or a region. In general, an MxN block can include a set (or an array) of M columns and N rows of samples (or sample array) or transform coefficients.

[0056] In this document, the terms “ / ” and “,” are to be interpreted as “and / or”. For example, the expression “A / B” can mean “A and / or B”. Also, “A, B” can mean “A and / or B”. Also, “A / B / C” can mean “at least one of A, B, and / or C”. Also, “A / B / C” can mean “at least one of A, B, and / or C”.

[0057] Also, in this document, the term “or” is to be interpreted as “and / or”. For example, the expression “A or B” can include 1) only A, 2) only B, and / or 3) both A and B. In other words, the term “or” in this document is to be interpreted as “additionally or alternatively”.

[0058] Figure 2 FIG. 1 is a schematic diagram illustrating a configuration of a video / image encoding apparatus to which embodiments of the present document can be applied. Hereinafter, the video encoding apparatus can include an image encoding apparatus.

[0059] Referring to FIG. 1, Figure 2 The encoding apparatus 200 includes an image partitioner 210, a predictor 220, a residual processor 230, and an entropy encoder 240, an adder 250, a filter 260, and a memory 270. The predictor 220 can include an inter-predictor 221 and an intra-predictor 222. The residual processor 230 can include a transformer 232, a quantizer 233, a dequantizer 234, and an inverse transformer 235. The residual processor 230 can further include a subtractor 231. The adder 250 can be referred to as a reconstructor or a reconstructed block generator. According to an embodiment, the image partitioner 210, the predictor 220, the residual processor 230, the entropy encoder 240, the adder 250, and the filter 260 can be constituted by at least one hardware component (e.g., an encoder chipset or a processor). In addition, the memory 270 can include a decoded picture buffer (DPB) or can be constituted by a digital storage medium. The hardware component can further include the memory 270 as an internal / external component.

[0060] The image partitioner 210 can partition an input image (or picture or frame) input to the encoding apparatus 200 into one or more processors. For example, the processor can be referred to as a coding unit (CU). In this case, the coding unit can be recursively split from a coding tree unit (CTU) or a largest coding unit (LCU) according to a quad tree binary tree ternary (QTBTT) structure. For example, one coding unit can be partitioned into a plurality of coding units having a deeper depth based on a quad tree structure, a binary tree structure, and / or a ternary structure. In this case, for example, the quad tree structure can be first applied, and then the binary tree structure and / or the ternary structure can be applied. Alternatively, the binary tree structure can be first applied. The coding process according to the present document can be performed based on the final coding unit that is no longer partitioned. In this case, the largest coding unit can be used as the final coding unit based on coding efficiency according to image characteristics, or if necessary, the coding unit can be recursively partitioned into a coding unit having a deeper depth and having an optimal size, and the coding unit can be used as the final coding unit. Here, the coding process can include a process of prediction, transform, and reconstruction, which will be described later. As another example, the processor can further include a prediction unit (PU) or a transform unit (TU). In this case, the prediction unit and the transform unit can be separated or partitioned from the final coding unit described above. The prediction unit can be a unit of sample prediction, and the transform unit can be a unit for deriving a transform coefficient and / or a unit for deriving a residual signal from the transform coefficient.

[0061] In some cases, a unit can be used interchangeably with terms such as a block or an area. In general, an MxN block can represent a set of samples or transform coefficients consisting of M columns and N rows. A sample can generally represent a pixel or a pixel value, can represent only a pixel / pixel value of a luminance component, or can represent only a pixel / pixel value of a chrominance component. A sample can be used as a term corresponding to a picture (or image) of pixels or texels.

[0062] In the encoding device 200, a prediction signal (prediction block, prediction sample array) output from the inter-predictor 221 or the intra-predictor 222 is subtracted from an input image signal (original block, original sample array) to generate a residual signal (residual block, residual sample array) and the generated residual signal is sent to the transformer 232. In this case, as illustrated, a unit for subtracting a prediction signal (prediction block, prediction sample array) from an input image signal (original block, original sample array) in the encoder 200 can be referred to as a subtractor 231. The predictor can perform prediction on a block to be processed (hereinafter referred to as a current block) and generate a prediction block including predicted samples of the current block. The predictor can determine whether to apply intra-prediction or inter-prediction on a basis of the current block or CU. As described later in the description of each prediction mode, the predictor can generate various information related to prediction, such as prediction mode information, and send the generated information to the entropy encoder 240. The information about prediction can be encoded in the entropy encoder 240 and output in the form of a bitstream.

[0063] The intra-predictor 222 can predict the current block by referring to samples in the current picture. Depending on the prediction mode, the referred samples can be located in the vicinity of the current block, or can be far away from the current block. In intra-prediction, the prediction mode can include a plurality of non-directional modes and a plurality of directional modes. The non-directional modes can include, for example, a DC mode and a planar mode. Depending on the level of detail of the prediction direction, the directional modes can include, for example, 33 directional prediction modes or 65 directional prediction modes. However, this is only an example, and depending on the settings, more or less directional prediction modes can be used. The intra-predictor 222 can determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring block.

[0064] The inter predictor 221 can derive a prediction block of a current block based on a reference block (a reference sample array) specified by a motion vector on a reference picture. Here, to reduce the amount of motion information transmitted in the inter prediction mode, motion information can be predicted in units of a block, a sub-block, or a sample based on the correlation of motion information between neighboring blocks and the current block. The motion information can include a motion vector and a reference picture index. The motion information can further include inter prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter prediction, the neighboring blocks can include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block can be the same or different. The temporal neighboring block can be referred to as a collocated reference block, a collocated CU (col CU), etc., and the reference picture including the temporal neighboring block can be referred to as a collocated picture (col Pic). For example, the inter predictor 221 can configure a motion information candidate list based on the neighboring blocks, and generate information indicating which candidate to use to derive a motion vector and / or a reference picture index of the current block. Inter prediction can be performed based on various prediction modes. For example, in the case of a skip mode and a merge mode, the inter predictor 221 can use motion information of the neighboring blocks as motion information of the current block. In the skip mode, unlike the merge mode, a residual signal can not be transmitted. In the case of a motion vector prediction (MVP) mode, a motion vector of the neighboring block can be used as a motion vector predictor, and a motion vector of the current block can be indicated by signaling a motion vector difference.

[0065] The predictor 220 can generate a prediction signal based on various prediction methods described below. For example, the predictor can not only apply intra prediction or inter prediction to predict one block, but also can simultaneously apply both intra prediction and inter prediction. This can be referred to as combined inter-intra prediction (CIIP). In addition, the predictor can predict a block based on an intra block copy (IBC) prediction mode or a palette mode. The IBC prediction mode or the palette mode can be used for content image / video encoding of a game or the like, for example, screen content coding (SCC). The IBC basically performs prediction in the current picture, but can perform the IBC similarly to inter prediction in that a reference block is derived in the current picture. That is, the IBC can use at least one of the inter prediction techniques described in the present document. The palette mode can be regarded as an example of intra coding or intra prediction. When the palette mode is applied, sample values within a picture can be signaled based on information about a palette table and a palette index.

[0066] The prediction signal generated by the predictor (including the inter-predictor 221 and / or the intra-predictor 222) can be used to generate a reconstructed signal or to generate a residual signal. The transformer 232 can generate transform coefficients by applying a transform technique to the residual signal. For example, the transform technique can include at least one of a discrete cosine transform (DCT), a discrete sine transform (DST), a karhunen-loève transform (KLT), a graph-based transform (GBT), or a conditional nonlinear transform (CNT). Here, the GBT denotes a transform obtained from a graph when relationship information between pixels is represented by a graph. The CNT refers to a transform generated based on a prediction signal generated using all previously reconstructed pixels. Also, the transform process can be applied to a square pixel block having the same size, or can be applied to a block having a variable size other than a square.

[0067] The quantizer 233 can quantize the transform coefficients and transmit them to the entropy encoder 240, and the entropy encoder 240 can encode the quantized signal (information about the quantized transform coefficients) and output a bitstream. The information about the quantized transform coefficients can be referred to as residual information. The quantizer 233 can rearrange the block-type quantized transform coefficients into a one-dimensional vector form based on a coefficient scan order, and generate information about the quantized transform coefficients based on the one-dimensional vector-form quantized transform coefficients. Information about the transform coefficients can be generated. The entropy encoder 240 can perform various encoding methods such as, for example, exponential Golomb, context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), and the like. The entropy encoder 240 can encode information (e.g., values of syntax elements, etc.) required for video / image reconstruction, together with or separately from the quantized transform coefficients. The encoded information (e.g., encoded video / image information) can be transmitted or stored in the form of a bitstream in units of NAL (network abstraction layer). The video / image information can further include information about various parameter sets such as an adaptive parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information can further include general constraint information. In the present document, information and / or syntax elements transmitted / signaled from the encoding apparatus to the decoding apparatus can be included in the video / picture information. The video / picture information can be encoded through the above-described encoding process and included in the bitstream. The bitstream can be transmitted through a network, or can be stored in a digital storage medium. The network can include a broadcast 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. A transmitter (not shown) that transmits a signal output from the entropy encoder 240 and / or a storage unit (not shown) that stores the signal can be included as an internal / external element of the encoding apparatus 200, or alternatively, the transmitter can be included in the entropy encoder 240.

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

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

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

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

[0072] The DPB of the memory 270 can store the modified reconstructed picture used as a reference picture in the inter-predictor 221. The memory 270 can store motion information of a block from which motion information in a current picture is derived (or encoded), and / or motion information of a reconstructed block in a picture. The stored motion information can be transmitted to the inter-predictor 221, and used as motion information of a spatial neighboring block or motion information of a temporal neighboring block. The memory 270 can store reconstructed samples of a reconstructed block in a current picture, and can transfer the reconstructed samples to the intra-predictor 222.

[0073] Figure 3 is a schematic diagram illustrating a configuration of a video / image decoding apparatus to which embodiments of the present document can be applied.

[0074] Referring to Figure 3 , the decoding apparatus 300 can include an entropy decoder 310, a residue processor 320, a predictor 330, an adder 340, a filter 350, a memory 360. The predictor 330 can include an inter-predictor 332 and an intra-predictor 331. The residue processor 320 can include a dequantizer 321 and an inverse transformer 322. According to an embodiment, the entropy decoder 310, the residue processor 320, the predictor 330, the adder 340, and the filter 350 can be constituted by hardware components (e.g., a decoder chipset or a processor). In addition, the memory 360 can include a decoded picture buffer (DPB), or can be constituted by a digital storage medium. The hardware components can further include the memory 360 as an internal / external component.

[0075] When a bitstream including video / image information is input, the decoding apparatus 300 can reconstruct an image corresponding to the processing of the video / image information in the encoding apparatus. Figure 2 For example, the decoding apparatus 300 can derive a unit / block based on block partitioning-related information obtained from the bitstream. The decoding apparatus 300 can perform decoding using a processor applied in the encoding apparatus. Thus, the processor for decoding can be, for example, a coding unit, and can partition a coding unit from a coding tree unit or a largest 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 reproduced by a reproducing apparatus.

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

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

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

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

[0080] The predictor 320 can generate a prediction signal based on various prediction methods described below. For example, the predictor can not only apply intra prediction or inter prediction to predict one block, but also can simultaneously apply intra prediction and inter prediction. This can be referred to as combined inter and intra prediction (CIIP). In addition, the predictor can predict a block based on an intra block copy (IBC) prediction mode or a palette mode. The IBC prediction mode or the palette mode can be used for content image / video encoding of games, etc., for example, screen content coding (SCC). The IBC basically performs prediction in the current picture, but can be performed similarly to inter prediction in that a reference block is derived in the current picture. That is, the IBC can use at least one of the inter prediction techniques described in this document. The palette mode can be regarded as an example of intra coding or intra prediction. When the palette mode is applied, sample values within a picture can be signaled based on information about a palette table and a palette index.

[0081] The intra predictor 331 can predict the current block by referring to samples in the current picture. Depending on the prediction mode, the referred samples can be located in the vicinity of the current block, or can be far from the current block. In intra prediction, the prediction mode can include a plurality of non-directional modes and a plurality of directional modes. The intra predictor 331 can determine a prediction mode applied to the current block by using a prediction mode applied to a neighboring block.

[0082] The inter predictor 332 can derive a prediction block of the current block based on reference blocks (reference sample arrays) specified by motion vectors on reference pictures. In this case, to reduce the amount of motion information transmitted in the inter prediction mode, motion information can be predicted in units of a block, a sub-block, or a sample based on the correlation of motion information between neighboring blocks and the current block. The motion information can include a motion vector and a reference picture index. The motion information can further include inter prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter prediction, the neighboring blocks can include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference pictures. For example, the inter predictor 332 can configure a motion information candidate list based on the neighboring blocks and derive a motion vector and / or a reference picture index of the current block based on received candidate selection information. The inter prediction can be performed based on various prediction modes, and information about the prediction can include information indicating a mode of the inter prediction for the current block.

[0083] The adder 340 can generate a reconstructed signal (a reconstructed picture, a reconstructed block, a reconstructed sample array) by adding the obtained residual signal to a prediction signal (a prediction block, a prediction sample array) output from the predictor (including the inter predictor 332 and / or the intra predictor 331). If there is no residual for a block to be processed (for example, when a skip mode is applied), the prediction block can be used as the reconstructed block.

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

[0085] Further, luma mapping with chroma scaling (LMCS) can be applied in the picture decoding process.

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

[0087] The reconstructed picture stored in the DPB of the memory 360 can be used as a reference picture in the inter prediction 332. The memory 360 can store motion information of a block from which motion information in a current picture is derived (or decoded) and / or motion information of a reconstructed block in a picture. The stored motion information can be transmitted to the inter prediction 260 to be utilized as motion information of a spatial neighboring block or motion information of a temporal neighboring block. The memory 360 can store reconstructed samples of a reconstructed block in a current picture and can transfer the reconstructed samples to the intra prediction 331.

[0088] In the present disclosure, the embodiments described in the filter 260, the inter prediction 221, and the intra prediction 222 of the encoding apparatus 200 can be the same as or respectively applied to correspond to the filter 350, the inter prediction 332, and the intra prediction 331 of the decoding apparatus 300. The same can also apply to the inter prediction 332 and the intra prediction 331.

[0089] As described above, the encoding apparatus can perform various encoding methods such as exponential Golomb, context adaptive variable length coding (CAVLC), and context adaptive binary arithmetic coding (CABAC). In addition, the decoding apparatus can decode information in a bitstream based on an encoding method such as exponential Golomb encoding, CAVLC, or CABAC, and output values of syntax elements required for image reconstruction and quantized values of transform coefficients related to a residual.

[0090] For example, the above-described encoding method can be performed as follows.

[0091] Figure 4 Context adaptive binary arithmetic coding (CABAC) for encoding a syntax element is exemplarily illustrated. For example, in the CABAC encoding process, when an input signal is a syntax element rather than a binary value, the encoding apparatus can convert the input signal into a binary value by binarizing a value of the input signal. In addition, when the input signal is already a binary value (i.e., when the value of the input signal is a binary value), binarization can not be performed and can be bypassed. Here, each binary digit 0 or 1 constituting a binary value can be referred to as a bin. For example, if a binary string after binarization is 110, each of 1, 1, and 0 is referred to as a bin. A bin of one syntax element can indicate a value of the syntax element.

[0092] Thereafter, the bins of the syntax elements can be input to a regular coding engine or a bypass coding engine. The regular coding engine of the encoding apparatus can assign a context model reflecting a probability value to the corresponding bin, and can encode the corresponding bin based on the assigned context model. The regular coding engine of the encoding apparatus can update the context model of each bin after performing encoding on each bin. The bins encoded as described above can be referred to as context-coded bins.

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

[0094] The entropy decoding can denote a process of performing the same processes as the above-described entropy encoding in reverse order.

[0095] For example, when the syntax elements are decoded based on the context models, the decoding apparatus can receive the bins corresponding to the syntax elements through a bitstream, determine the context models using the syntax elements and the decoded information of the target block or the neighboring blocks or the information of the symbols / bins decoded in the previous stage, predict the occurrence probability of the received bins according to the determined context models, and perform arithmetic decoding on the bins to derive the values of the syntax elements. Thereafter, the context models of the bins decoded next can be updated with the determined context models.

[0096] In addition, for example, when the syntax elements are bypass-decoded, the decoding apparatus can receive the bins corresponding to the syntax elements through a bitstream, and decode the input bins by applying a uniform probability distribution. In this case, the processes of the decoding apparatus for deriving the context models of the syntax elements and the processes of updating the context models applied to the bins after decoding can be omitted.

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

[0098] For example, the (quantized) transform coefficients (i.e., residual information) can 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. The syntax elements related to residual data encoding / decoding can be represented as shown in the following table.

[0099] [Table 1]

[0100]

[0101]

[0102]

[0103]

[0104] transform_skip_flag indicates whether a transform is skipped in a related block. The transform_skip_flag can be a syntax element of a transform skip flag. The related block can be a coding block (CB) or a transform block (TB). The CB and the TB can be interchangeably used with respect to a transform (and quantization) and a residual coding process. For example, as described above, for a CB, residual samples can be derived, and (quantized) transform coefficients can be derived by a transform and quantization for the residual samples and by a residual coding process, information (e.g., syntax elements) effectively indicating positions, magnitudes, signs, etc. of the (quantized) transform coefficients can be generated and signaled. The quantized transform coefficients can be simply referred to as transform coefficients. Generally, when the CB is not larger than a maximum TB, a size of the CB can be the same as a size of the TB, and in this case, a target block to be transformed (and quantized) and residual coded can be referred to as a CB or a TB. Meanwhile, when the CB is larger than the maximum TB, a target block to be transformed (and quantized) and residual coded can be referred to as a TB. Hereinafter, it will be described that syntax elements related to a residual coding are signaled in units of transform blocks (TBs), but this is an example and the TBs can be interchangeably used with coding blocks (CBs as described above).

[0105] In an embodiment, the encoding device can encode (x, y) position information of a last non-zero transform coefficient in a transform block based on the 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 indicates a prefix of a column position of a last significant coefficient in a scan order within the transform block, the last_sig_coeff_y_prefix indicates a prefix of a row position of the last significant coefficient in the scan order within the transform block, the last_sig_coeff_x_suffix indicates a suffix of the column position of the last significant coefficient in the scan order within the transform block, and the last_sig_coeff_y_suffix indicates a suffix of the row position of the last significant coefficient in the scan order within the transform block. Here, the significant coefficient can mean a non-zero coefficient. In addition, the scan order can be a right diagonal scan order. Alternatively, the scan order can be a horizontal scan order or a vertical scan order. The scan order can be determined based on whether intra / inter prediction is applied to a target block (CB or a CB including a TB) and / or a particular intra / inter prediction mode.

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

[0107] If the value of coded_sub_block_flag is 0, there is no more information to be transmitted, and thus, the encoding device can terminate the encoding process for the current sub-block. In contrast, if the value of coded_sub_block_flag is 1, the encoding device can continue the encoding process for sig_coeff_flag. Since a sub-block including the last non-zero coefficient does not need to encode coded_sub_block_flag and a sub-block including DC information of the transform block has a high probability of including a non-zero coefficient, coded_sub_block_flag can not be encoded and its value can be assumed to be 1.

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

[0109] The level value remaining after encoding sig_coeff_flag can be derived as shown in the following equation. That is, a syntax element remAbsLevel indicating the level value to be encoded can be derived from the following equation.

[0110] [Equation 1]

[0111] remAbsLevel = |coeff| - 1

[0112] In this context, coeff means an actual transform coefficient value.

[0113] Additionally, abs_level_gt1_flag can indicate whether remAbsLevel' of the corresponding scan position (n) is greater than 1. For example, when the value of abs_level_gt1_flag is 0, the absolute value of the transform coefficient of the corresponding position can be 1. Also, when the value of abs_level_gt1_flag is 1, remAbsLevel indicating the level value to be coded later can be derived as shown in the following Equation.

[0114] [Equation 2]

[0115] remAbsLevel = remAbsLevel - 1

[0116] In addition, the least significant bit (LSB) value of remAbsLevel described in the above Equation 2 can be coded by par_level_flag as in the following Equation 3.

[0117] [Equation 3]

[0118] par_level_flag = remAbsLevel & 1

[0119] In this context, par_level_flag [n] can indicate the parity of the transform coefficient level (value) at the scan position n.

[0120] The transform coefficient level value remAbsLevel to be coded after performing par_level_flag coding can be updated as shown in the following Equation.

[0121] [Equation 4]

[0122] remAbsLevel' = remAbsLevel » 1

[0123] abs_level_gt3_flag can indicate whether remAbsLevel' of the corresponding scan position (n) is greater than 3. abs_remainder can be coded only in the case where rem_abs_gt3_flag is equal to 1. The relationship between the actual transform coefficient value coeff and each syntax element can be as shown in the following Equation.

[0124] [Equation 5]

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

[0126] Additionally, the following table indicates examples related to Equation 5 above.

[0127] [Table 2]

[0128]

[0129] In this context, |coeff| indicates the transform coefficient level (value) and can also be indicated as AbsLevel of the transform coefficient. Additionally, the sign of each coefficient can be encoded by using coeff_sign_flag as a 1-bit symbol.

[0130] Additionally, dec_abs_level can represent an intermediate value that is coded with a Golomb-Rice code at the corresponding scan position (n). dec_abs_level can be signaled for scan positions that satisfy the conditions disclosed in Table 2 above. In this case, the absolute value AbsLevel (i.e., |coeff|) of the corresponding transform coefficient is derived as one of 0, dec_abs_level + 1, dec_abs_level depending on the conditions.

[0131] Additionally, coeff_sign_flag can indicate the sign of the transform coefficient level at the corresponding scan position (n). That is, coeff_sign_flag can indicate the sign of the transform coefficient at the corresponding scan position (n).

[0132] Additionally, mts_idx can indicate a transform kernel applied to the residual samples in the current transform block in the horizontal direction and the vertical direction.

[0133] Figure 5 An example of transform coefficients within a 4x4 block is illustrated.

[0134] Figure 5 A 4x4 block of illustrates one example of quantized coefficients. Figure 5 The block illustrated in illustrates a 4x4 transform block or a 4x4 sub-block of 8x8, 16x16, 32x32, and 64x64 transform blocks. Figure 5 The 4x4 block of illustrates a luma block or a chroma block.

[0135] For example, the following table shows Figure 5 The coding results of the coefficients scanned inversely diagonally illustrated in are shown.

[0136] [Table 3]

[0137] scan_pos 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 coefficients 0 0 0 0 1 -1 0 2 0 3 -2 -3 4 6 -7 10 sig_coeff_flag 0 0 0 0 1 1 0 1 0 1 1 1 1 1 abs_level_gt1_flag 0 0 1 1 1 1 1 1 par_level_flag 0 1 0 1 0 0 abs_level_gt3_flag 1 1 abs_remainder 0 1 dec_abs_level 7 10 coeff_sign_flag 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0

[0138] In Table 3, scan_pos denotes a position of a coefficient according to inverse diagonal scanning. scan_pos 15 can denote a transform coefficient scanned first in a 4x4 block, i.e., a transform coefficient of a lower right corner, while scan_pos 0 can be a transform coefficient scanned last, i.e., a transform coefficient of an upper left corner. Meanwhile, in one embodiment, scan_pos can be referred to as a scan position. For example, scan_pos 0 can be referred to as scan position 0.

[0139] Meanwhile, CABAC provides high performance but has a drawback of poor throughput performance. This characteristic is caused by a regular coding engine of CABAC, in which regular coding (i.e., encoding by the regular coding engine of CABAC) uses a probability state and a range updated by encoding of a previous bin, thereby presenting high data dependency and taking much time to read a probability interval and determine a current state. The throughput problem of CABAC can be solved by limiting the number of context-coded bins. For example, as shown in Table 1, the sum of bins for expressing sig_coeff_flag, abs_level_gt1_flag, and par_level_flag can be limited depending on the size of a corresponding block. In one example, when the corresponding block is a 4x4 size block, the sum of bins of sig_coeff_flag, abs_level_gt1_flag, and par_level_flag can be limited to 28. On the other hand, when the corresponding block is a 2x2 size block, the sum of bins of sig_coeff_flag, abs_level_gt1_flag, and par_level_flag can be limited to 6. remBinsPass1 can express the limited number of bins. In addition, the number depending on the size of the corresponding block can limit the number of context-coded bins of abs_level_gt3_flag. For example, in the case of a 4x4 size block, the number of bins of abs_level_gt3_flag can be limited to 4, while in the case of a 2x2 size block, the number of bins of abs_level_gt3_flag can be limited to 2. remBinsPass2 can express the limited number of bins of abs_level_gt3_flag. In this case, when an encoding device uses all of the limited number of context-coded bins to code context elements, the remaining coefficients can be binarized without using CABAC by a binarization method for coefficients described later to perform bypass coding.

[0140] Meanwhile, as described above, when the input signal is received in the form of a syntax element rather than a binary value, the encoding apparatus can convert the input signal into a binary value through binarization. Also, the decoding apparatus can decode the syntax element to derive a binarized value (i.e., bin) of the syntax element and de-binarize the binarized value to derive a 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, or a fixed length (FL) binarization process. Also, the de-binarization process can refer to a process of deriving a value of the syntax element by performing the TR binarization process, the EGk binarization process, or the FL binarization process.

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

[0142] An input of the TR binarization process can be a request for TR binarization and cMax and cRiceParam of the syntax element. Also, an output of the TR binarization process can be TR binarization for a value symbolVal corresponding to a bin string.

[0143] Specifically, as one example, in a case where there is a suffix bin string of the syntax element, the TR bin string of the syntax element can be a concatenation of the prefix bin string and the suffix bin string; in a case where there is no suffix bin string, the TR bin string of the syntax element can be the prefix bin string. For example, the prefix bin string can be derived as follows.

[0144] A prefix value of the symbolVal of the syntax element can be derived to satisfy the following equation.

[0145] [Equation 6]

[0146] prefixVal = symbolVal » cRiceParam

[0147] In Equation 6, prefixVal denotes a prefix value of symbolVal. The prefix of the TR bin string of the syntax element (i.e., the prefix bin string) can be derived as follows.

[0148] For example, when the prefixVal is less than cMax » cRiceParam, the prefix bin string can be a bit string of length prefixVal + 1 indexed by the binIdx. In other words, when the prefixVal is less than cMax » cRiceParam, the prefix bin string can be a bit string having prefixVal + 1 bits indicated by the binIdx. The bins corresponding to the binIdx less than the prefixVal can be equal to 1. In addition, the bin corresponding to the binIdx having the same value as the prefixVal can be equal to 0.

[0149] For example, the bin string derived by unary binarization for the prefixVal can be given as follows.

[0150] [Table 4]

[0151]

[0152] Meanwhile, when the prefixVal is not less than cMax » cRiceParam, the prefix bin string can be a bit string of length cMax » cRiceParam and all of whose bins are 1.

[0153] In addition, when the cMax is greater than the symbolVal and the cRiceParam is greater than 0, there can be a suffix bin string of the TR bin string. For example, the suffix bin string can be derived as described later.

[0154] The suffix value of the symbolVal of the syntax element can be derived by the following equation.

[0155] [Equation 7]

[0156] suffixVal = symbolVal - ((prefixVal) « cRiceParam

[0157] Here, the suffixVal can denote the suffix value of the symbolVal.

[0158] The suffix (i.e., the suffix bin string) of the TR bin string can be derived based on the FL binarization process for the suffixVal, in which the cMax value is (1 « cRiceParam) - 1.

[0159] Meanwhile, if the value of the input parameter cRiceParam is 0, the TR binarization can be the exact-truncated unary binarization, and the cMax value equal to the maximum possible value of the syntax element that is always decoded can be used.

[0160] Additionally, for example, the EGk binarization process can be performed as follows. The syntax element binarized by ue(v) can be an Exp-Golumb binarized syntax element.

[0161] In one example, a 0th order Exp-Golomb (EG0) binarization process can be performed as follows.

[0162] The parsing process of the syntax element can start by reading bits (including the first non-zero bit) from the current position of the bitstream and counting the number of leading bits such as 0. The following table describes the above process.

[0163] [Table 5]

[0164]

[0165] Additionally, the variable codeNum can be derived by the following equation.

[0166] [Equation 8]

[0167] codeNum = 2 leadingZeroBits - 1 + read_bits(leadingZeroBits)

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

[0169] The following table shows the structure of the Exp-Golomb code, where the bit string is divided into "prefix" bits and "suffix" bits.

[0170] [Table 6]

[0171] bit string form range of codeNum h 0 [0 1 x0] 1..2 [["0 0 1 x1 x0"]] 3..6 [0 0 0 1 x2 x1 x0] 7..14 0 0 0 0 1 x3 x2 x1 x0 15..30 0 0 0 0 0 1 x4 x3 x2 x1 x0 31..62 ... ...

[0172] The "prefix" bits can be the bits parsed to calculate leadingZeroBits as described above and can be represented by 0 or 1 of the bit string in Table 6. In other words, the bit string starting with 0 or 1 in the above Table 6 can represent the prefix bit string. The "suffix" bits can be the bits parsed from the calculation of codeNum and can be represented by x i in the above Table 6. In other words, the bit string starting with x i in the above Table 6 can represent the suffix bit string. Here, i can be a value ranging from 0 to LeadZeroBits-1. Additionally, each x i may correspond to 0 or 1.

[0173] The following table shows the bit string assigned to codeNum.

[0174] [Table 7]

[0175] bit string codeNum 1 0 0 1 0 1 0 1 1 2 0 0 1 0 0 3 0 0 1 0 1 4 0 0 1 1 0 5 0 0 1 1 1 6 0 0 0 1 0 0 0 7 0 0 0 1 0 0 1 8 0 0 0 1 0 1 0 9 ... ...

[0176] When the descriptor of the syntax element is ue(v), that is, when the syntax element is coded by ue(v), the value of the syntax element can be the same as codeNum.

[0177] In addition, for example, the EGk binarization process can be performed as follows.

[0178] The input of the EGk binarization process can be a request for EGk binarization. In addition, the output of the EGk binarization process can be the EGk binarization for symbolVal corresponding to the bin string.

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

[0180] [Table 8]

[0181]

[0182] Referring to the above Table 8, a binary value X can be added to the end of the bin string by each call of put(X). Here, X can be 0 or 1.

[0183] In addition, for example, the FL binarization process can be performed as follows.

[0184] The input of the FL binarization process can be a request for FL binarization and cMax of the syntax element. In addition, the output of the FL binarization process can be the FL binarization for symbolVal corresponding to the bin string.

[0185] The FL binarization can be performed using a bit string having a fixed length of bits corresponding to the symbol value symbolVal. Here, the fixed length bits can be an unsigned integer bit string. That is, the bit string of the symbol value symbolVal can be derived by the FL binarization, and the bit length (i.e., the number of bits) of the bit string can be a fixed length.

[0186] For example, the fixed length can be derived by the following equation.

[0187] [Equation 9]

[0188] fixedLength = ceil(Log2(cMax + 1))

[0189] The index of a bin for FL binarization can use a value that increases in order from the most significant bit to the least significant bit. For example, a bin index related to the most significant bit can be binldx = 0.

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

[0191] An input of the binarization process for abs_remainder and dec_abs_level is a request for binarization of a syntax element abs_remainder[n] or a syntax element dec_abs_level[n], a color component cldx, a luma position (x0, y0), a current coefficient scan position (xC, yC), log2TbWidth that is a binary logarithm of a width of a transform block, and log2TbHeight that is a binary logarithm of a height of a transform block. The luma position (x0, y0) can indicate a top-left sample of a current luma transform block based on a top-left luma sample of a picture.

[0192] An output of the binarization process for abs_remainder (or dec_abs_level) can be a binarization of abs_remainder (or dec_abs_level) (i.e., a bin string of the binarization of abs_remainder (or dec_abs_level)). An available bin string of abs_remainder (or dec_abs_level) can be derived through the binarization process.

[0193] A Rice parameter cRiceParam of abs_remainder (or dec_abs_level) can be derived through a Rice parameter derivation process performed using a color component cldx, a luma position (x0, y0), a current coefficient scan position (xC, yC), and a binary logarithm log2TbHeight of a height of a transform block as inputs. A detailed description of the Rice parameter derivation process will be described later.

[0194] In addition, for example, cMax of abs_remainder (or dec_abs_level) can be derived based on the Rice parameter cRiceParam. cMax can be derived through the following equation.

[0195] [Equation 10]

[0196] cMax(cRiceParam6<<cRiceParam

[0197] Referring to Equation 10, cMax can be derived as 6<<cRiceParam if the value of cRiceParam is 1, and as 7<<cRiceParam if the value of cRiceParam is not 1.

[0198] On the other hand, in the case where the suffix bin string exists, the binarization of abs_remainder (or dec_abs_level), i.e., the bin string of abs_remainder (or dec_abs_level), can be a concatenation of the prefix bin string and the suffix bin string. Also, in the case where the suffix bin string does not exist, the bin string of abs_remainder (or dec_abs_level) can be the prefix bin string.

[0199] For example, the prefix bin string can be derived as described later.

[0200] The prefix value prefixVal of abs_remainder can be derived by the following equation.

[0201] [Equation 11]

[0202] prefixVal = Min(cMax, abs_remainder[n])

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

[0204] If the prefix bin string is identical to a bit string of all bits being 1 and having a length of 4, the suffix bin string of the bin string of abs_remainder can exist and can be derived as described below.

[0205] The suffix value suffixVal of abs_remainder can be derived by the following equation.

[0206] [Equation 12]

[0207] suffixVal = abs_remainder[n] - cMax

[0208] The suffix bin string of the bin string of abs_remainder can be derived by an EGk binarization process for suffixVal, where k is set to cRiceParam+1.

[0209] Meanwhile, the above Rice parameter derivation process can be as follows.

[0210] The input of the Rice parameter derivation process is a color component index cldx, a luma position (x0, y0), a current coefficient scan position (xC, yC), a log2TbWidth which is a binary logarithm of a width of a transform block, and a log2TbHeight which is a binary logarithm of a height of the transform block. The luma position (x0, y0) can indicate a top-left sample of a current luma transform block based on a top-left luma sample of a picture. In addition, the output of the Rice parameter derivation process can be a Rice parameter cRiceParam.

[0211] For example, a variable locSumAbs can be derived based on a given syntax element sig_coeff_flag[x][y], a component index cldx, and an array AbsLevel[x][C] of a transform block at a top-left luma position (x0, y0) according to the pseudo code shown in the following table.

[0212] [Table 9]

[0213]

[0214] The Rice parameter cRiceParam can be derived as follows.

[0215] For example, when locSumAbs is less than 12, cRiceParam can be set to 0. Alternatively, when the above condition is not satisfied and locSumAbs is less than 25 (i.e., when locSumAbs is greater than or equal to 12 and less than 25), cRiceParam can be set to 1. Or, when the above condition is not satisfied (i.e., when locSumAbs is greater than or equal to 25), cRiceParam can be set to 2.

[0216] Meanwhile, unlike the embodiment of transmitting the above syntax elements, a method of signaling tu_mts_idx can be proposed.

[0217] Specifically, the method of signaling tu_mts_idx in the existing VVC Draft 3 can be compared with the method of signaling the proposed tu_mts_idx as follows.

[0218] [Table 10]

[0219]

[0220] As shown in Table 10, according to the existing scheme, the MTS flag of the current block is first parsed, and then the transform skip flag is parsed, after which MTS index coding can be performed. Here, coding for the MTS index can be performed through fixed length binarization, and the fixed bit length of the MTS index can be 2.

[0221] Alternatively, according to the proposed scheme, the MTS index can be coded without separately parsing the transform skip flag and the MTS flag, and the truncated unary binarization can be used to code the MTS index. Here, the MTS index can indicate whether the transform is applied to the residual information of the current block, and can indicate whether the MTS is applied. That is, in the proposed scheme, a scheme of signaling the transform skip flag, the MTS flag, and the MTS index as one syntax element can be proposed. In the proposed scheme, a first bin of the MTS index can indicate whether the transform is applied to the residual information of the current block, and a second bin of the MTS index can indicate whether the MTS is applied and the applied transform kernel.

[0222] The meaning indicated by the value of the MTS index and the binarized value in the proposed method can be as shown in the following table.

[0223] [Table 11]

[0224]

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

[0226] Alternatively, another example of the meaning indicated by the value of the MTS index and the binarized value can be as shown in the following table.

[0227] [Table 12]

[0228]

[0229] For example, when the value of the MTS index is 0, the MTS index can indicate that no transform is applied to the current block (i.e., no MTS is applied and no transform kernel type is indicated). Also, when the value of the MTS index is 1, the MTS index can 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. Also, when the value of the MTS index is 2, the MTS index can indicate that a transform and MTS are applied to the current block and the horizontal and vertical transform kernel types are DST-7. Also, when the value of the MTS index is 3, the MTS index can 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. Also, when the value of the MTS index is 4, the MTS index can indicate that a transform and MTS are applied to the current block, the horizontal transform kernel type is DST-7, and the vertical transform kernel type is DCT-8. Also, when the value of the MTS index is 5, the MTS index can indicate that a transform and MTS are applied to the current block and the horizontal and vertical transform kernel types are DCT-8.

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

[0231] [Table 13]

[0232]

[0233] In addition, the document proposes a method of modifying the contents in the existing residual coding method (described later) to apply a method of representing the statistics and signal characteristics of the transform skip level of the quantized prediction residual (i.e., the residual in the spatial domain) to the residual coding.

[0234] Position of the last non-zero transform coefficient: Since the residual signal (i.e., the residual sample) reflects the spatial residual and is not performed by the transform skip after the prediction but by the transform for the energy compression, the high probability of the trailing zero or the inactive level at the right lower of the transform block can not occur any more. Therefore, in this case, the information about the scan position of the last non-zero transform coefficient can be omitted. Alternatively, the first sub-block to be coded first can be the right lower sub-block in the transform block. Meanwhile, the non-zero transform coefficient can be referred to as the active coefficient.

[0235] Sub-block CBF: In the case where the signaling of the information about the scan position of the last non-zero transform coefficient is not present, the transform skip is applied, and the CBF signaling of the sub-block with coded_sub_block_flag should be modified as follows.

[0236] Due to quantization, the sequence of non-significant levels mentioned above can still occur locally within the transform block. Therefore, the information on the scan position of the last non-zero transform coefficient can be removed as mentioned above and coded_sub_block_flag can be coded for all sub-blocks.

[0237] In addition, coded_sub_block_flag for the sub-block at the DC frequency position (top-left sub-block) can indicate a special case. For example, in VVC Draft 3, the coded_sub_block_flag for the top-left sub-block is not signaled and can always be derived to be equal to 1. When the scan position of the last non-zero transform coefficient is located in a sub-block that is not the top-left sub-block, it can be indicated that there is at least one significant level outside the DC sub-block (i.e., the top-left sub-block). As a result, the coded_sub_block_flag for the DC sub-block is derived to be 1 but can include only 0 / non-significant levels. As mentioned above, if transform skip is applied to the current block and there is no information on the scan position of the last non-zero transform coefficient, the coded_sub_block_flag for each sub-block can be signaled. Here, the coded_sub_block_flag for the DC sub-block can also be included except when the coded_sub_block_flag for all sub-blocks except the DC sub-block is already 0. In this case, the 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 should have at least one significant level, if all sig_coeff_flag except for 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).

[0238] In addition, the context modeling of coded_sub_block_flag can be changed. For example, the context model index can be calculated by the sum of the coded_sub_block_flag of the right sub-block of the current sub-block and the coded_sub_block_flag of the lower sub-block of the current sub-block and the logical separation of coded_sub_block_flag.

[0239] Sig_coeff_flag context modeling: The local template for sig_coeff_flag context modeling can be modified to include only the right position NB0 and the lower position NB1 of the current scan position. The context model offset can be derived as the number of sig_coeff_flag [NB0] + sig_coeff_flag [NB1] of the effective peripheral positions. Thus, the selection of different context sets according to the diagonal d of the current transform block can be eliminated. As a result, three context models and a single context model can be set to code sig_coeff_flag.

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

[0241] Abs_remainder coding: The empirical distribution of transform skip residual absolute levels still fits a Laplacian or geometric distribution, but there can be instability greater than the transform coefficient absolute levels. In particular, the covariance can be higher for residual absolute levels within a window of consecutive realizations. Thus, the binarization and context modeling of abs_remainder can be modified as follows.

[0242] For example, a higher cutoff value can be used for the binarization of abs_remainder. Thereby, a higher compression efficiency can be provided in the transition from coding using sig_coeff_flag, abs_level_gt1_flag, par_level_flag, and abs_level_gt3_flag to a Rice code for abs_remainder and a dedicated context model for each bin position. If the cutoff value is increased, more flags of "greater than X" (e.g., abs_level_gt5_flag, abs_level_gt7_flag, etc.) can occur until the cutoff value is reached. The cutoff value can be fixed to 5 (numGtFlags = 5).

[0243] In addition, the template for the Rice parameter derivation can be modified. That is, only the right peripheral position and the lower peripheral position of the current scan position can be considered as the local template for sig_coeff_flag context modeling.

[0244] Coeff sign flag context modeling: Due to instability within the sign sequence and the fact that the prediction residual is often biased, a context model can be used to code the sign-related information even when the global empirical distribution is almost uniformly distributed. A single dedicated context model can be used for the coding of the sign-related information, and the sign-related information can be parsed after sig_coeff_flag and maintained with all the context-coded bins.

[0245] Reduction of context-coded bins: The transmission of the first-pass syntax elements (i.e., sig_coeff_flag, abs_level_gt1_flag, and par_level_flag) can not change. However, the limit of the maximum value of the context-coded bins (CCB) per sample can be removed and can be adjusted to be different. In the case of CCB>k, the CCB reduction can be derived by specifying an invalid mode. Here, k can be a positive integer. For example, in the case of the regular level coding mode, k can be 2 (k=2). The above-mentioned limit can correspond to a reduction of the quantization space.

[0246] The syntax elements related to the residual data coded by applying the above-mentioned modifications can be expressed as shown in the following table.

[0247] [Table 14]

[0248]

[0249] Meanwhile, as shown in Table 1 above, according to the VVC standard, whether to apply the transform of the corresponding block can be first transmitted before encoding / decoding the residual signal (i.e., residual information). That is, the transform skip flag (i.e., transform_skip_flag) indicating whether to apply the transform can be first parsed before parsing the residual information of the current block. The transform skip flag can be referred to as a transform or non-transform flag or a transform application flag.

[0250] By expressing the correlation between the residual signals in the transform domain, the data is compressed (data compression) and delivered to the decoding device, but if the correlation between the residual signals is insufficient, the data compression can not occur sufficiently. In this case, the conversion process including a complex calculation process can be omitted and the residual signal in the pixel domain (spatial domain) can be transmitted to the decoding device. Since the residual signal in the pixel domain to which the transform is not applied has different characteristics (e.g., distribution of the residual signal, absolute level of each residual signal, etc.) from the residual signal in the general transform domain, a residual signal coding / decoding method for efficiently delivering the signal to the decoding device is proposed.

[0251] Figure 6A decoding device for performing the proposed method of transmitting a residual signal in a pixel domain is exemplarily shown.

[0252] The transform skip flag can be transmitted in units of transform blocks. Here, referring to Table 1 above, the transform skip flag can be parsed by restricting it to a certain block size. That is, referring to Table 1 above, the transform skip flag can be parsed only for transform blocks whose block size is equal to or smaller than a certain size. For example, when the size of the current transform block is smaller than or equal to a 4x4 size, the transform skip flag of the current transform block can be parsed.

[0253] In this regard, as an example, the document proposes embodiments for determining whether the size of the block for which the transform skip flag is parsed is configured differently. Specifically, the size of log2TbWidth and log2TbHeight can be determined by variables wN and hN, and according to the existing scheme, wN and hN can be selected from one of the following.

[0254] - wN = {2, 3, 4, 5, 6}

[0255] - hN = {2, 3, 4, 5, 6}

[0256] That is, wN can be selected from one of 2, 3, 4, 5, and 6, and hN can be selected from one of 2, 3, 4, 5, and 6.

[0257] The method of parsing the transform skip flag according to the present embodiment can be represented as shown in the following table.

[0258] [Table 15]

[0259]

[0260] According to the present embodiment disclosed in Table 15, when log2TbWidth indicating the width of the current block (i.e., the current transform block) is equal to or smaller than wN, and log2TbHeight indicating the height of the current block is equal to or smaller than hN, the transform skip flag of the current block can be parsed. The method of decoding the residual signal of the current block can be determined based on the transform skip flag. Through the proposed embodiments, by efficiently processing signals having different statistical characteristics, the complexity of the entropy decoding process can be reduced and the coding efficiency can be improved.

[0261] Alternatively, referring to Table 1 above, an embodiment can be proposed in which the transform skip flag is parsed by limiting the transform skip flag to a certain block size, but a condition for determining whether to parse the transform skip flag is defined as the number of samples of a block, not the width and height information of the corresponding block. That is, for example, a method of using the product of log2TbWidth and log2TbHeight as a condition of a syntax element transform_skip_flag for determining whether to parse the transform skip flag can be proposed.

[0262] log2TbWidth and log2TbHeight can be selected from one of the following.

[0263] log2TbWidth = {1, 2, 3, 4, 5, 6}

[0264] log2TbHeight = {1, 2, 3, 4, 5, 6}

[0265] That is, log2TbWidth can be selected from one of 1, 2, 3, 4, 5, and 6, and log2TbHeight can be selected from one of 1, 2, 3, 4, 5, and 6.

[0266] Figure 7a and Figure 7b An embodiment of determining whether to parse the transform skip flag based on the number of samples of the current block and a decoding apparatus performing the same are exemplarily illustrated.

[0267] Referring to Figure 7a , the decoding apparatus can determine whether to allow determination of whether to skip the transform of the current block in the high-level syntax (S700). When the determination of whether to skip the transform of the current block is allowed in the high-level syntax, the decoding apparatus can determine whether the value of the syntax element cu_mts_flag is 0 (S710).

[0268] When the value of cu_mts_flag is 0, the decoding apparatus can determine whether the product of log2TbWidth and log2TbHeight of the current block is equal to or less than a threshold value (S720). That is, the decoding apparatus can determine whether the number of samples of the current block is equal to or less than the threshold value.

[0269] When the product of log2TbWidth and log2TbHeight is equal to or less than the threshold value, the decoding apparatus can parse the value of the syntax element transform_skip_flag of the transform skip flag as 1 (S730).

[0270] Meanwhile, when the conditions of steps S700 to S720 are not satisfied, the decoding device can derive the value of the syntax element transform_skip_flag of the transform skip flag to be 0 (S740).

[0271] Figure 7b A decoding device for performing an embodiment for determining whether to transform a block by the number of samples in the block is exemplarily illustrated. Referring to Figure 7b , the decoding device can determine whether to parse the transform skip flag for the block based on whether transform skip is allowed in the high-level syntax, block size information, and whether MTS is applied.

[0272] In the case of determining whether to transform based on the number of samples in a block, blocks having various shapes can be included in the transform exclusion block compared to controlling whether to transform by the width and height of the block. For example, if both log2TbWidth and log2TbHeight are defined as 2 in the embodiment of controlling whether to transform by the width and height of the block described above, only blocks of size 2x4, blocks of size 4x2, and blocks of size 4x4 can be included in the transform exclusion block. However, if whether to transform is controlled by the number of samples, blocks of size 2x8 and blocks of size 8x2 can also be included as the transform exclusion block.

[0273] A method of decoding a residual signal can be determined based on a transform skip flag. In addition, by efficiently processing signals having different statistical characteristics through the proposed embodiments, complexity in the entropy decoding process can be reduced and coding efficiency can be improved.

[0274] For example, the following embodiment of encoding and decoding a residual signal considering statistical characteristics in the case where a transform is not applied to a residual signal of a current block can be proposed.

[0275] Generally, in the case of a transform block to which a transform and quantization are applied (i.e., a transform coefficient to which a transform and quantization are applied), energy is concentrated near the upper left portion of the transform block by the transform, and the level of energy is reduced in the direction toward the lower right (high frequency region) by the quantization. In consideration of the aforementioned characteristics, as Figure 5 The diagonal scanning technique has been introduced for efficient residual coding as shown in the related art. However, in the case of a transform skip block (i.e., a transform block including a residual coefficient to which a transform is not applied), energy can exist uniformly in the entire block without being concentrated on the upper left corner, and the size of the level is also random. Therefore, it can be inefficient to encode using the diagonal scanning technique. Accordingly, the embodiment proposes a residual scanning scheme suitable for the characteristics of the transform skip block. Here, the residual coefficient can refer to a transform coefficient.

[0276] In addition, as another feature of the transform skip block, when the prediction mode applied to the transform skip block to be currently coded is the intra prediction mode, the size of the residual samples increases in the direction of the right lower portion where the distance between the prediction samples and the reference samples is large. In consideration of these characteristics, the present embodiment proposes a method in which the residual signals are rearranged and coded so that they can be scanned from the upper left portion of the transform block, and the decoding device parses the residual signals and rearranges them back to their original positions. That is, the present embodiment proposes a method in which the residual signals are rearranged and coded so that the residual signals having a large size can be scanned from the upper left portion of the transform block, and the decoding device parses the residual signals and rearranges them back to their original positions. As a similar effect, a method of defining a new scanning method in the residual signal coding and decoding steps can be considered. However, when the residual signals are rearranged as in the method proposed in the present embodiment, the existing residual coding module can be used without modification.

[0277] When rearranging the residual while maintaining the existing residual coding module, a point to be considered is that the scanning order should be defined from the upper left region to the lower right region.

[0278] As an example of the rearrangement method, a method of rotating the current block by 180 degrees can be defined.

[0279] Figure 8 The residual coefficients of the current block to which the rearrangement method of rotating by 180 degrees is applied are exemplarily shown.

[0280] Figure 8 The numbers in the current block shown in FIG. 10 indicate the pixel positions in the block in the raster scan order. Referring to FIG. 10, Figure 8 The residual coefficients in the upper left position can be rearranged to the lower right position, which is a position rotated by 180 degrees. Referring to FIG. 11, Figure 8 The residual coefficients can be rearranged to positions symmetrical with respect to the center of the transform block through the rearrangement process of rotating by 180 degrees. After the rearrangement, the general residual coefficient scan order can be applied, and due to the rearrangement, the residual coefficients located at the lower right portion can be considered first, and due to the rearrangement, the residual coefficients located at the upper left portion can be scanned later.

[0281] Alternatively, as another example of the rearrangement method, a method of mirroring the current block can be defined. At the same time, the method can be divided into anti-diagonal mirroring and main diagonal mirroring according to the direction of mirroring.

[0282] Figure 9 The residual coefficients of the current block to which the mirroring rearrangement method is applied are exemplarily shown. Figure 9 (a) of FIG. 12 exemplifies an example of rearranging the residual coefficients of the current block by anti-diagonal mirroring, and (b) of FIG. 12 exemplifies an example of rearranging the residual coefficients of the current block by main diagonal mirroring.Figure 9 (b) illustrates an example of rearranging the residual coefficients of the current block by main diagonal mirroring.

[0283] Referring to Figure 9 (a), the residual coefficients can be rearranged to positions symmetrical with respect to the right-up diagonal line of the current block through a rearrangement process of anti-diagonal mirroring. Here, the right-up diagonal line can indicate a diagonal line passing through the center of the current block in a right-up direction. For example, the residual coefficient at the upper-left position can be rearranged to the lower-right position, which is a position mirrored anti-diagonally. Also, for example, the #1 residual coefficient (i.e., the residual coefficient adjacent to the right side of the residual coefficient in the upper-left position) can be rearranged to a position adjacent to the lower-right position, which is a position mirrored anti-diagonally. That is, when the width and height of the current block are 4 and the x component and y component of the upper-left sample position of the current block are 0, the residual coefficient at position (1, 0) can be rearranged to position (3, 3), which is a position mirrored anti-diagonally.

[0284] Also, referring to Figure 9 (b), the residual coefficients can be rearranged to positions symmetrical with respect to the left-up diagonal line of the current block through a rearrangement process of main diagonal mirroring. Here, the left-up diagonal line can indicate a diagonal line passing through the center of the current block in a left-up direction. For example, the residual coefficient at the upper-right position can be rearranged to the lower-left position, which is a position mirrored diagonally. Also, for example, the #1 residual coefficient (i.e., the residual coefficient adjacent to the right side of the residual coefficient in the upper-left position) can be rearranged to a position adjacent to the lower side of the upper-left position, which is a position mirrored diagonally. That is, when the width and height of the current block are 4 and the x component and y component of the upper-left sample position of the current block are 0, the residual coefficient at position (1, 0) can be rearranged to position (0, 1), which is a position mirrored diagonally.

[0285] Alternatively, as another example of a rearrangement method, a method of flipping the current block can be defined. Meanwhile, the vertical flip and the horizontal flip can be defined separately according to an axis used as a flip reference.

[0286] Figure 10 An example of the residual coefficients of the current block to which the flip rearrangement method is applied is exemplarily shown. Figure 10 (a) illustrates an example of rearranging the residual coefficients of the current block by vertical flipping, and Figure 9 (b) illustrates an example of rearranging the residual coefficients of the current block by horizontal flipping.

[0287] Referring to Figure 10of (a), the residual coefficients can be rearranged to positions symmetrical with respect to a vertical axis of the current block by a vertical flipping rearrangement process. Here, the vertical axis can denote a vertical line passing through the center of the current block. For example, the residual coefficient in the top-left position can be rearranged to the top-right position, which is the position of vertical flipping. Also, for example, the #1 residual coefficient (i.e., the residual coefficient adjacent to the right side of the residual coefficient in the top-left position) can be rearranged to a position adjacent to the left side of the top-right position, which is the position of vertical flipping. That is, when the width and height of the current block are 4 and the x component and y component of the top-left sample position of the current block are 0, the residual coefficient in the position (1, 0) can be rearranged to the (2, 0) position, which is the position of vertical flipping.

[0288] Also, referring to Figure 10 of (b), the residual coefficients can be rearranged to positions symmetrical with respect to a horizontal axis of the current block by a horizontal flipping rearrangement process. Here, the horizontal axis can denote a horizontal line passing through the center of the current block. For example, the residual coefficient in the top-right position can be rearranged to the bottom-right position, which is the position of horizontal flipping. Also, for example, the #1 residual coefficient (i.e., the residual coefficient adjacent to the right side of the residual coefficient in the top-right position) can be rearranged to a position adjacent to the left side of the bottom-right position, which is the position of horizontal flipping. That is, when the width and height of the current block are 4 and the x component and y component of the top-left sample position of the current block are 0, the residual coefficient in the position (1, 0) can be rearranged to the (1, 3) position, which is the position of horizontal flipping.

[0289] Alternatively, as another example of the rearrangement method, a method of rearranging the residual coefficients of the current block according to a distance from a reference sample of intra prediction can be proposed. For example, layers can be defined in a TU according to a distance between the reference sample and the prediction block, and the encoding apparatus can determine whether to scan the residual coefficients in each layer in a horizontal-first scan or a vertical-first scan, and can rearrange the residual coefficients in an inverse raster order (from right to left, from bottom to top) according to the scan order. That is, layers of the current block can be defined based on a distance from a reference sample, and the encoding apparatus / decoding apparatus can determine a scan order of the residual coefficients in each layer as a horizontal-first scan or a vertical-first scan, and rearrange the residual coefficients in an inverse raster order (from right to left, from bottom to top) according to the scan order. Meanwhile, the decoding apparatus can derive the existing residual coefficients by performing the above rearrangement process in an inverse order.

[0290] Figure 11 The residual coefficients of the current block to which the above-described embodiments are applied are exemplarily shown, in which layers divided based on a distance from a reference sample are derived and rearranged in positions according to an inverse raster order. Figure 11(a) of FIG. 1 illustrates an example of rearranging residual coefficients in each layer at positions according to an inverse raster order in a transverse-first scan order, and Figure 11 (b) of FIG. 1 illustrates an example of rearranging residual coefficients in each layer at positions according to an inverse raster order in a longitudinal-first scan order.

[0291] Referring to Figure 11 , the layers of the current block include a first layer adjacent to at least one reference sample, a second layer having a distance of 1 from the nearest reference sample, a third layer having a distance of 2 from the nearest reference sample, and a fourth layer having a distance of 3 from the nearest reference sample. That is, the first layer can include residual coefficients adjacent to at least one reference sample (e.g., Figure 11 #0 to #4 residual coefficients, #8 residual coefficient, and #12 residual coefficient of the current block before rearrangement illustrated in (a) of FIG. 1) (in other words, the first layer can include residual coefficients having a distance of 1 from the nearest reference sample), the second layer can include residual coefficients having a distance of 2 from the nearest reference sample (e.g., Figure 11 #5 to #7 residual coefficients, #9 residual coefficient, and #13 residual coefficient of the current block before rearrangement illustrated in (b) of FIG. 1), the third layer can include residual coefficients having a distance of 3 from the nearest reference sample (e.g., Figure 11 #10 and #11 residual coefficients, and #14 residual coefficient of the current block before rearrangement illustrated in (a) of FIG. 1), and the fourth layer can include residual coefficients having a distance of 4 from the nearest reference sample (e.g., Figure 11 #15 residual coefficient of the current block before rearrangement illustrated in (b) of FIG. 1).

[0292] When the layers of the current block are defined as described above, the encoding apparatus can determine one of the transverse-first scan and the longitudinal-first scan as a scan method for the layers of the current block.

[0293] For example, when the transverse-first scan is determined as the scan method for the layers of the current block, the rearrangement of the residual coefficients can be performed as illustrated in (a) of FIG. 1. Figure 11

[0294] Specifically, the encoding apparatus can scan in order from the first layer to the fourth layer, can scan from the residual coefficient at the top-left position in the corresponding layer to the longitudinal side, can scan all of the residual coefficients of the longitudinal side, and can scan the remaining residual coefficients of the longitudinal side from top to bottom.

[0295] ​For example, the transverse residual coefficients in the first layer can include #0 to #3 residual coefficients, and the longitudinal residual coefficients in the first layer can include #4, #8, and #12 residual coefficients. The encoding / decoding device can scan the transverse residual coefficients in the first layer from left to right in order (in the order of #1, #2, and #3 residual coefficients), and thereafter, the encoding / decoding device can scan the longitudinal residual coefficients in the first layer from top to bottom in order (in the order of #4, #8, and #12 residual coefficients). Next, the second layer can be scanned. The transverse residual coefficients in the second layer can include #5 to #7 residual coefficients, and the longitudinal residual coefficients in the second layer can include #9 and #13 residual coefficients. The encoding device can scan the transverse residual coefficients in the second layer from left to right in order (in the order of #5, #6, and #7 residual coefficients), and then scan the transverse residual coefficients in the second layer from top to bottom in order (in the order of #9 and #13 residual coefficients). Next, the third layer can be scanned. The transverse residual coefficients in the third layer can include #10 and #11 residual coefficients, and the longitudinal residual coefficients in the third layer can include #14 residual coefficient. The encoding device can scan the transverse residual coefficients in the third layer from left to right in order (in the order of #10 and #11 residual coefficients), and then scan the longitudinal residual coefficients in the third layer from top to bottom in order (in the order of #14 residual coefficient). Next, the fourth layer can be scanned. The transverse residual coefficients in the fourth layer can include #15 residual coefficient. The encoding device can scan the transverse residual coefficients in the fourth layer from left to right in order (scan #15 residual coefficient).

[0296] Thereafter, with reference to (a) of FIG. 6, Figure 11 The encoding device can rearrange the residual coefficients in the scan order at the positions according to the inverse raster order (from right to left, from bottom to top). The scan order of the residual coefficients can be the order of #0, #1, #2, #3, #4, #8, #12, #5, #6, #7, #9, #13, #10, #11, #14, and #15 residual coefficients. The residual coefficients can be rearranged in the scan order to the positions according to the inverse raster order in the current block. For example, the #0 residual coefficient can be rearranged in the right-bottom position, the #1, #2, and #3 residual coefficients can be rearranged in the left direction of the right-bottom position, the #4, #8, #12, and #5 residual coefficients can be rearranged in the upper row (i.e., the third row of the current block) of the right-bottom position from right to left in order, the #6, #7, #9, and #13 residual coefficients can be rearranged in the second row of the current block from right to left in order, and the #10, #11, #14, and #15 residual coefficients can be rearranged in the first row of the current block from right to left in order.

[0297] In addition, for example, when the longitudinal-first scan is determined as the scan method for the layer of the current block, as Figure 11performing the re-arrangement of the residual coefficients as shown in (b) of FIG. 10.

[0298] In particular, the encoding device can scan in order from the first layer to the fourth layer, can scan from the residual coefficient at the top-left position in the corresponding layer to the vertical side, can scan all of the residual coefficients of the vertical side, and can scan the remaining residual coefficients of the vertical side from top to bottom.

[0299] For example, the vertical residual coefficients in the first layer can include #0, #4, #8, and #12 residual coefficients in the first layer, and the horizontal residual coefficients in the first layer can include #1 to #3 residual coefficients. The encoding device can scan the vertical residual coefficients in the first layer in order from top to bottom (scan in order of #0, #4, #8, and #12 residual coefficients), and thereafter, the encoding device can scan the horizontal residual coefficients in the first layer from left to right (scan in order of #1, #2, and #3 residual coefficients). Next, the second layer can be scanned. The vertical residual coefficients in the second layer can include #5, #9, and #13 residual coefficients, and the horizontal residual coefficients in the second layer can include #6 and #7 residual coefficients. The encoding device can scan the vertical residual coefficients in the second layer in order from top to bottom (scan in order of #5, #9, and #13 residual coefficients), and then scan the horizontal residual coefficients in the second layer from left to right (scan in order of #6 and #7 residual coefficients). Next, the third layer can be scanned. The vertical residual coefficients in the third layer can include #10 and #14 residual coefficients, and the horizontal residual coefficients in the third layer can include #11 residual coefficient. The encoding device can scan the vertical residual coefficients in the third layer from top to bottom (scan in order of #10 and #14 residual coefficients), and then scan the horizontal residual coefficients in the third layer from left to right (scan in order of #11 residual coefficient). Next, the fourth layer can be scanned. The vertical residual coefficients in the fourth layer can include #15 residual coefficient. The encoding device can scan the vertical residual coefficients in the fourth layer from top to bottom in order of #15 residual coefficient.

[0300] Thereafter, referring to Figure 11of (b), the encoding apparatus can rearrange the residual coefficients in the scan order at the positions according to the inverse raster order (from right to left, top to bottom). The scan order of the residual coefficients can be the order of #0, #4, #8, #12, #1, #2, #3, #5, #9, #13, #6, #7, #10, #14, #11, and #15 residual coefficients. The residual coefficients can be rearranged in the scan order into the positions according to the inverse raster order in the current block. For example, the #0 residual coefficient can be rearranged at the right bottom position, and the #4, #8, and #12 residual coefficients can be rearranged in the left direction of the right bottom position, the #1, #2, #3, and #5 residual coefficients can be rearranged in order from right to left in the upper row (the third row of the current block) of the right bottom position, the #9, #13, #6, and #7 residual coefficients can be rearranged in order from right to left in the second row of the current block, and the #10, #14, #11, and #15 residual coefficients can be rearranged in order from right to left in the first row of the current block.

[0301] Alternatively, another embodiment of rearranging the residual coefficients of the current block according to the distance from the reference sample of the intra prediction can be proposed. For example, the layers can be defined in the TU according to the distance between the reference sample and the prediction block, and the encoding apparatus can determine whether to scan the residual coefficients in a horizontal-first scan or a vertical-first scan in each layer, and can rearrange the residual coefficients in a diagonal scan order according to the scan order. That is, the layers of the current block can be defined based on the distance from the reference sample, and the encoding apparatus can determine the scan order of the residual coefficients in each layer as a horizontal-first scan or a vertical-first scan, and rearrange the residual coefficients in a diagonal scan order according to the scan order to the positions. Meanwhile, the decoding apparatus can derive the existing residual coefficients by performing the above rearrangement process in the reverse order.

[0302] Figure 12 The residual coefficients of the current block to which the above embodiments are applied are exemplarily shown, in which the layers divided based on the distance from the reference sample are derived and rearranged in the positions according to the diagonal scan order. Figure 12 (a) of (b) exemplifies an example of rearranging the residual coefficients in each layer in the positions according to the diagonal scan order in a horizontal-first scan order, and Figure 12 (b) of (b) exemplifies an example of rearranging the residual coefficients in each layer in the positions according to the diagonal scan order in a vertical-first scan order.

[0303] Referring to Figure 12, the layers of the current block include a first layer adjacent to at least one reference sample, a second layer having a distance of 1 from the nearest reference sample, a third layer having a distance of 2 from the nearest reference sample, and a fourth layer having a distance of 3 from the nearest reference sample. That is, the first layer can include residual coefficients adjacent to at least one reference sample (e.g., Figure 12 The #0 to #4 residual coefficients, the #8 residual coefficient, and the #12 residual coefficient of the current block before rearrangement illustrated in (a) of FIG. 10) (in other words, the first layer can include residual coefficients having a distance of 1 from the nearest reference sample), the second layer can include residual coefficients having a distance of 2 from the nearest reference sample (e.g., Figure 12 The #5 to #7 residual coefficients, the #9 residual coefficient, and the #13 residual coefficient of the current block before rearrangement illustrated in (b) of FIG. 10) (in other words, the third layer can include residual coefficients having a distance of 3 from the nearest reference sample), and the fourth layer can include residual coefficients having a distance of 4 from the nearest reference sample (e.g., Figure 12 The #10 and #11 residual coefficients, and the #14 residual coefficient of the current block before rearrangement illustrated in (c) of FIG. 10) (in other words, the fourth layer can include residual coefficients having a distance of 4 from the nearest reference sample), and the fourth layer can include residual coefficients having a distance of 4 from the nearest reference sample (e.g., Figure 12 The #15 residual coefficient of the current block before rearrangement illustrated in (d) of FIG. 10).

[0304] When the layers of the current block are defined as described above, the encoding apparatus can determine one of the horizontal-first scan and the vertical-first scan as a scan method for the layers of the current block.

[0305] For example, when the horizontal-first scan is determined as the scan method for the layers of the current block, the rearrangement of the residual coefficients can be performed as illustrated in (a) of FIG. 11. Figure 12

[0306] Specifically, the encoding apparatus can scan in order from the first layer to the fourth layer, can scan from the residual coefficient at the top-left position in the corresponding layer to the vertical side, can scan all of the residual coefficients of the horizontal side, and can scan the remaining residual coefficients of the vertical side from top to bottom.

[0307] ​For example, the transverse residual coefficients in the first layer can include #0 through #3 residual coefficients, while the longitudinal residual coefficients in the first layer can include #4, #8, and #12 residual coefficients. The encoding device can scan the transverse residual coefficients in the first layer from left to right in order (in the order of #1, #2, and #3 residual coefficients), and thereafter, the encoding / decoding device can scan the longitudinal residual coefficients in the first layer from top to bottom in order (in the order of #4, #8, and #12 residual coefficients). Next, the second layer can be scanned. The transverse residual coefficients in the second layer can include #5 through #7 residual coefficients, while the longitudinal residual coefficients in the second layer can include #9 and #13 residual coefficients. The encoding device can scan the transverse residual coefficients in the second layer from left to right in order (in the order of #5, #6, and #7 residual coefficients), and then scan the transverse residual coefficients in the second layer from top to bottom in order (in the order of #9 and #13 residual coefficients). Next, the third layer can be scanned. The transverse residual coefficients in the third layer can include #10 and #11 residual coefficients, while the longitudinal residual coefficients in the third layer can include #14 residual coefficients. The encoding device can scan the transverse residual coefficients in the third layer from left to right in order (in the order of #10 and #11 residual coefficients), and then scan the longitudinal residual coefficients in the third layer from top to bottom in order (in the order of #14 residual coefficients). Next, the fourth layer can be scanned. The transverse residual coefficients in the fourth layer can include #15 residual coefficients. The encoding device can scan the transverse residual coefficients in the fourth layer from left to right in order (scanning the #15 residual coefficient).

[0308] Thereafter, with reference to Figure 12According to (a) of FIG. 1, the encoding apparatus can rearrange the residual coefficients in a scan order according to a diagonal scan order (from the upper right to the lower left, from the lower right to the upper left) at the positions. The scan order of the residual coefficients can be the order of #0, #1, #2, #3, #4, #8, #12, #5, #6, #7, #9, #13, #10, #11, #14, and #15 residual coefficients. The residual coefficients can be rearranged in the scan order to the positions according to the diagonal scan order in the current block. For example, the #0 residual coefficient can be rearranged at the lower right position positioned on the first upper right diagonal, the #1 and #2 residual coefficients can be sequentially rearranged from the upper right side to the upper left side in the second upper right diagonal (i.e., the upper left side to the upper right diagonal of the first upper right diagonal) of the current block, the #3, #4, and #8 residual coefficients can be sequentially rearranged from the upper right side to the upper left side in the third upper right diagonal (i.e., the upper left side to the upper right diagonal of the second upper right diagonal), the #12, #5, #6, and #7 residual coefficients can be sequentially rearranged in the fourth upper right diagonal (i.e., the upper left side to the upper right diagonal of the third upper right diagonal), the #9, #13, and #10 residual coefficients can be sequentially rearranged from the upper right side to the upper left side in the fifth upper right diagonal (i.e., the upper left side to the upper right diagonal of the fourth upper right diagonal), the #11 and #14 residual coefficients can be sequentially rearranged from the upper right side to the upper left side in the sixth upper right diagonal (i.e., the upper left side to the upper right diagonal of the fifth upper right diagonal), and the #15 residual coefficient can be rearranged at the upper left position positioned in the seventh upper right diagonal (i.e., the upper left side to the upper right diagonal of the sixth upper right diagonal).

[0309] In addition, for example, when the vertical-first scan is determined as the scan method of the layer of the current block, the rearrangement of the residual coefficients is performed as shown in (b) of FIG. 1. Figure 12

[0310] Specifically, the encoding apparatus can scan in order from the first layer to the fourth layer, can scan from the residual coefficient at the upper left position in the corresponding layer to the vertical side, can scan all of the residual coefficients of the vertical side, and can scan the remaining residual coefficients of the vertical side from the top to the bottom.

[0311] ​For example, the longitudinal residual coefficients in the first layer can include the #0 residual coefficient, the #4 residual coefficient, the #8 residual coefficient, and the #12 residual coefficient in the first layer, while the transverse residual coefficients in the first layer can include the #1 to #3 residual coefficients. The encoding device can scan the longitudinal residual coefficients in the first layer in order from top to bottom (scan in order of the #0, #4, #8, and #12 residual coefficients), and thereafter, the encoding device can scan the transverse residual coefficients in the first layer from left to right (scan in order of the #1, #2, and #3 residual coefficients). Next, the second layer can be scanned. The longitudinal residual coefficients in the second layer can include the #5, #9, and #13 residual coefficients, while the transverse residual coefficients in the second layer can include the #6 and #7 residual coefficients. The encoding device can scan the longitudinal residual coefficients in the second layer in order from top to bottom (scan in order of the #5, #9, and #13 residual coefficients), and then scan the transverse residual coefficients in the second layer from left to right (scan in order of the #6 and #7 residual coefficients). Next, the third layer can be scanned. The longitudinal residual coefficients in the third layer can include the #10 and #14 residual coefficients, while the transverse residual coefficients in the third layer can include the #11 residual coefficient. The encoding device can scan the longitudinal residual coefficients in the third layer from top to bottom (scan in order of the #10 and #14 residual coefficients), and then scan the transverse residual coefficients in the third layer from left to right (scan in order of the #11 residual coefficient). Next, the fourth layer can be scanned. The longitudinal residual coefficients in the fourth layer can include the #15 residual coefficient. The encoding device can scan the longitudinal residual coefficients in the fourth layer in order from top to bottom (scan in order of the #15 residual coefficient).

[0312] Thereafter, with reference to Figure 12According to (b) of the above-described embodiment, the encoding apparatus can rearrange the residual coefficients in the scan order at the positions according to the diagonal scan order (from the upper right to the lower left, from the lower right to the upper left). The scan order of the residual coefficients can be the order of #0, #4, #8, #12, #1, #2, #3, #5, #9, #13, #6, #7, #10, #14, #11, and #15 residual coefficients. The residual coefficients can be rearranged in the scan order to the positions according to the diagonal scan in the current block. For example, the #0 residual coefficient can be rearranged at the lower right position positioned on the first upper right diagonal, the #4 and #8 residual coefficients can be sequentially rearranged in the second upper right diagonal (i.e., the upper left side to the upper right diagonal of the first upper right diagonal) of the current block from the upper right side to the upper left side, the #12, #1, and #2 residual coefficients can be sequentially rearranged in the third upper right diagonal (i.e., the upper left side to the upper right diagonal of the second upper right diagonal) from the upper right side to the upper left side, the #3, #5, #9, and #13 residual coefficients can be sequentially rearranged in the fourth upper right diagonal (i.e., the upper left side to the upper right diagonal of the third upper right diagonal) from the upper right side to the upper left side, the #6, #7, and #10 residual coefficients can be sequentially rearranged in the fifth upper right diagonal (i.e., the upper left side to the upper right diagonal of the fourth upper right diagonal) from the upper right side to the upper left side, the #14 and #11 residual coefficients can be sequentially rearranged in the sixth upper right diagonal (i.e., the upper left side to the upper right diagonal of the fifth upper left diagonal) from the upper right side to the upper left side, and the #15 residual coefficient can be rearranged at the upper left position positioned on the seventh upper right diagonal (i.e., the upper left side to the upper right diagonal of the sixth upper right diagonal).

[0313] Alternatively, another embodiment of rearranging the residual coefficients of the current block according to the distance from the reference sample of intra prediction can be proposed. For example, a method of setting a reference sample (a left reference sample or an upper reference sample) as a reference, defining layers of the current block based on the distance from the set reference sample, scanning the residual coefficients, and then rearranging the residual coefficients in the scan order at the positions according to the diagonal scan order can be proposed. Here, the residual coefficients in the layers defined based on the distance from the left reference sample can be scanned by a vertical-first scan, and the residual coefficients in the layers defined based on the distance from the upper reference sample can be scanned by a horizontal-first scan.

[0314] Figure 13 The residual coefficients of the current block to which the above-described embodiment is applied are exemplarily shown, in which the layers divided based on the distance from a specific reference sample are derived and rearranged in the positions according to the diagonal scan order. Figure 13 (a) of the above-described embodiment exemplifies an example of rearranging the residual coefficients in the layers set based on the distance from the upper reference sample in the positions according to the diagonal scan order in the horizontal-first scan order, andFigure 13 (b) illustrates an example of rearranging residual coefficients in a layer set based on a distance from an upper reference sample in a diagonal scan order in a longitudinal-first scan order. Meanwhile, a decoding device can derive existing residual coefficients by performing the above-described rearrangement process in a reverse order.

[0315] Referring to Figure 13 (a), the layers of the current block include a first layer adjacent to at least one upper reference sample, a second layer having a distance of 1 from the nearest upper reference sample, a third layer having a distance of 2 from the nearest upper reference sample, and a fourth layer having a distance of 3 from the nearest upper reference sample. That is, the first layer can include residual coefficients adjacent to at least one upper reference sample (e.g., #0 to #3 residual coefficients of the current block illustrated in (a) of Figure 13 (a) of FIG. 1), in other words, the first layer can include residual coefficients having a distance of 1 from the nearest upper reference sample, the second layer can include residual coefficients having a distance of 2 from the nearest upper reference sample (e.g., #4 to #7 residual coefficients of the current block illustrated in (a) of Figure 13 FIG. 1), the third layer can include residual coefficients having a distance of 3 from the nearest upper reference sample (e.g., #8 and #11 residual coefficients of the current block illustrated in (a) of Figure 13 FIG. 1), and the fourth layer can include residual coefficients having a distance of 4 from the nearest upper reference sample (e.g., #15 residual coefficient of the current block illustrated in (a) of Figure 13 FIG. 1). In other words, the first layer can be derived as a first row of the current block, the second layer can be derived as a second row of the current block, the third layer can be derived as a third row of the current block, and the fourth layer can be derived as a fourth row of the current block.

[0316] When the layers of the current block are defined as described above, the encoding device can determine a scan method for the layers of the current block as a transverse-first scan. Thereafter, as Figure 13 (a) of FIG. 1, rearrangement of residual coefficients can be performed.

[0317] Specifically, the encoding device can scan in order from the first layer to the fourth layer, and can scan from a residual coefficient of a left position to a residual coefficient of a right position in a corresponding layer.

[0318] As an example, the encoding device can scan the residual coefficients in the first layer sequentially from left to right (scanning in the order of residual coefficients #0, #1, #2, and #3). Next, the second layer can be scanned. The encoding device can scan the residual coefficients in the second layer sequentially from left to right (scanning in the order of residual coefficients #4, #5, #6, and #7). Next, the third layer can be scanned. The encoding device can scan the residual coefficients in the third layer sequentially from left to right (scanning in the order of residual coefficients #8, #9, #10, and #11). Next, the fourth layer can be scanned. The encoding device can scan the residual coefficients in the fourth layer sequentially from left to right (scanning residual coefficients #13, #14, and #15).

[0319] Subsequently, refer to Figure 13 (a) The encoding device can rearrange the residual coefficients at each position according to the scan order, based on the diagonal scan sequence (from top right to bottom left, or from bottom right to top left). The scan order of the residual coefficients can be the order of residual coefficients #0, #1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, and #15. The residual coefficients can be rearranged in the current block according to the diagonal scan order. For example, residual coefficient #0 can be rearranged to the lower right position on the first upper right diagonal; residual coefficients #1 and #2 can be rearranged sequentially from the upper right to the upper left in the second upper right diagonal of the current block (i.e., from the upper left to the upper right diagonal of the first upper right diagonal); residual coefficients #3, #4, and #5 can be rearranged sequentially from the upper right to the upper left in the third upper right diagonal (i.e., from the upper left to the upper right diagonal of the second upper right diagonal); and residual coefficients #6, #7, #8, and #9 can be rearranged sequentially from the upper right to the upper left in the fourth upper right diagonal (i.e., from the upper left to the upper right diagonal of the second upper right diagonal). In the upper right diagonal (from the upper left to the upper right diagonal), residual coefficients #10, #11, and #12 can be rearranged sequentially from the upper right to the upper left in the fifth upper right diagonal (i.e., from the upper left to the upper right diagonal of the fourth upper right diagonal). Residual coefficients #13 and #14 can be rearranged sequentially from the upper right to the upper left in the sixth upper right diagonal (i.e., from the upper left to the upper right diagonal of the fifth upper right diagonal). Residual coefficient #15 can be rearranged in the upper left position of the seventh upper right diagonal (i.e., from the upper left to the upper right diagonal of the sixth upper right diagonal).

[0320] Additionally, refer to Figure 13(b) The current block comprises a first layer adjacent to at least one left reference sample, a second layer at a distance of 1 from the nearest left reference sample, a third layer at a distance of 2 from the nearest left reference sample, and a fourth layer at a distance of 3 from the nearest left reference sample. That is, the first layer may include residual coefficients adjacent to at least one left reference sample (e.g., Figure 13 The residual coefficients of the current block before rearrangement, illustrated in (b) (in other words, the first layer may include residual coefficients at a distance of 1 from the nearest left reference sample), and the second layer may include residual coefficients at a distance of 2 from the nearest left reference sample (e.g., Figure 13 The residual coefficients of the current block before rearrangement, as illustrated in (b), may include residual coefficients at a distance of 3 from the nearest left reference sample (e.g., ...). Figure 13 The residual coefficients of the current block before rearrangement, as illustrated in (b), are #2, #6, #10, and #14, and the fourth layer may include residual coefficients at a distance of 4 from the nearest left reference sample (e.g., Figure 13 (The residual coefficients of #3, #7, #11, and #15 of the current block before rearrangement are illustrated in (b). In other words, the first layer can be derived as the first column of the current block, the second layer as the second column of the current block, the third layer as the third column of the current block, and the fourth layer as the fourth column of the current block.

[0321] When the layer of the current block is defined as described above, the encoding device can determine the scanning method for the layer of the current block as a vertical priority scan. Thereafter, as... Figure 13 As shown in (b), a rearrangement of the residual coefficients can be performed.

[0322] Specifically, the encoding device can scan sequentially from the first layer to the fourth layer, and can scan downwards from the residual coefficients at the upper position in the corresponding layer.

[0323] As an example, the encoding device can scan the residual coefficients in the first layer sequentially from top to bottom (scanning in the order of residual coefficients #0, #4, #8, and #12). Next, the second layer can be scanned. The encoding device can scan the residual coefficients in the second layer sequentially from top to bottom (scanning in the order of residual coefficients #1, #5, #9, and #13). Next, the third layer can be scanned. The encoding device can scan the residual coefficients in the third layer sequentially from top to bottom (scanning in the order of residual coefficients #2, #6, #10, and #14). Next, the fourth layer can be scanned. The encoding device can scan the residual coefficients in the fourth layer sequentially from top to bottom (scanning residual coefficients #3, #7, #11, and #15).

[0324] Subsequently, refer toFigure 14a of (b), the encoding apparatus can rearrange the residual coefficients at the positions according to the diagonal scan order (from the upper right to the lower left, from the lower right to the upper left) in the scan order. The scan order of the residual coefficients can be the order of #0, #4, #8, #12, #1, #5, #9, #13, #2, #6, #10, #14, #3, #7, #11, and #15 residual coefficients. The residual coefficients can be rearranged in the current block in the positions according to the diagonal scan order in the scan order. For example, the #0 residual coefficient can be rearranged at the lower right position positioned on the first upper right diagonal, the #4 and #8 residual coefficients can be sequentially rearranged in the second upper right diagonal (i.e., the upper left side to the upper right diagonal of the first upper right diagonal) of the current block from the upper right side to the upper left side, the #12, #1, and #5 residual coefficients can be sequentially rearranged in the third upper right diagonal (i.e., the upper left side to the upper right diagonal of the second upper right diagonal) from the upper right side to the upper left side, the #9, #13, #2, and #6 residual coefficients can be sequentially rearranged in the fourth upper right diagonal (i.e., the upper left side to the upper right diagonal of the third upper right diagonal) from the upper right side to the upper left side, the #10, #14, and #3 residual coefficients can be sequentially rearranged in the fifth upper right diagonal (i.e., the upper left side to the upper right diagonal of the fourth upper right diagonal) from the upper right side to the upper left side, the #7 and #11 residual coefficients can be sequentially rearranged in the sixth upper right diagonal (i.e., the upper left side to the upper right diagonal of the fifth upper right diagonal) from the upper right side to the upper left side, and the #15 residual coefficient can be rearranged at the upper left position positioned on the seventh upper right diagonal (i.e., the upper left side to the upper right diagonal of the sixth upper right diagonal).

[0325] Meanwhile, for example, the above rearrangement method can be performed when no transform is applied to the residual coefficients of the current block. That is, whether to apply the rearrangement method can be determined based on whether a transform of the residual coefficients is applied. In other words, whether to apply the rearrangement method can be determined based on a transform skip flag of the current block.

[0326] Figure 14b and Figure 14a An embodiment of determining whether to apply the rearrangement method based on a transform skip flag of a current block and an encoding apparatus and a decoding apparatus performing the same are illustrated.

[0327] Referring to Figure 14b, the encoding apparatus and the decoding apparatus can determine whether a value of a transform skip flag of the current block is 1 (S1400). When the value of the transform skip flag is 1, the encoding apparatus and the decoding apparatus can perform the re-arrangement method on the residual coefficients of the current block (S1410). Meanwhile, when the value of the transform skip flag is not 1 (i.e., when the value of the transform skip flag is 0), the encoding apparatus and the decoding apparatus can not perform the re-arrangement method on the residual coefficients of the current block. The transform skip flag can indicate whether a transform is applied to the residual coefficients of the current block. That is, the transform skip flag can indicate whether a transform is applied to the residual coefficients. A syntax element representing the transform skip flag can be the above-described transform_skip_flag.

[0328] In addition, referring to Figure 15 An encoding apparatus and a decoding apparatus that can exemplarily illustrate determining whether to apply the re-arrangement method based on a transform skip flag of a current block and performing a corresponding operation can be illustrated. A residual re-arrangement unit of the encoding apparatus can determine whether to re-arrange residual coefficients based on a transform skip flag of a current block, and when a value of the transform skip flag is 1, the residual re-arrangement unit can re-arrange the residual coefficients. A quantization unit and an entropy encoder of the encoding apparatus can quantize and entropy-encode the re-arranged residual coefficients to generate residual information, and output the encoded residual information through a bitstream. In addition, an entropy decoder of the decoding apparatus can receive the bitstream including the residual information of the current block and decode the residual information to derive quantized residual coefficients. Thereafter, a dequantizer of the decoding apparatus can dequantize (i.e., scale) the quantized residual coefficients to derive residual coefficients. A residual re-arrangement unit of the decoding apparatus can determine whether to re-arrange the residual coefficients based on a transform skip flag of a current block, and when a value of the transform skip flag is 1, the residual re-arrangement unit can re-arrange the residual coefficients.

[0329] As another example, a method of using the above-described re-arrangement method in combination under various conditions can be proposed.

[0330] As an example, the rearrangement method or whether to rearrange can be determined based on a size of the current block. Here, the size of the current block can indicate a number of samples of the current block or a width and a height of the current block. For example, when the number of samples of the current block is less than 64, a rearrangement method of rotating the residual coefficients of the current block by 180 degrees can be applied, and when the number of samples of the current block is 64 or more, the rearrangement method of mirroring the residual coefficients of the current block described above can be applied. Alternatively, as another example, when the number of samples of the current block is less than 64, one of the rearrangement methods described above can be applied to the residual coefficients of the current block, and when the number of samples of the current block is 64 or more, the rearrangement method can not be applied. Meanwhile, for example, the process of determining the rearrangement method or whether to rearrange based on a condition described above can be performed only when a value of a transform skip flag of the current block is 1. In other words, when the value of the transform skip flag of the current block is 1, the rearrangement method or whether to rearrange can be determined based on the size (the number of samples or the width and the height) of the current block.

[0331] Alternatively, as another example, the rearrangement method or whether to rearrange can be determined based on a shape of the current block. For example, when the current block is a square block (i.e., when the width and the height of the current block are the same), the rearrangement method of mirroring the residual coefficients of the current block can be applied. When the current block is a non-square block (i.e., when the width and the height values of the current block are not the same), the rearrangement method of rotating the residual coefficients of the current block by 180 degrees described above can be applied. Meanwhile, for example, the process of determining the rearrangement method or whether to rearrange based on a condition described above can be performed only when a value of a transform skip flag of the current block is 1. In other words, when the value of the transform skip flag of the current block is 1, the rearrangement method or whether to rearrange can be determined based on the shape of the current block.

[0332] Alternatively, as another example, the re-arrangement method or whether to re-arrange can be determined based on a width-to-height ratio of the current block. For example, in a case where the width-to-height ratio of the current block is 2 or more or 1 / 2 or less (i.e., when a value obtained by dividing the width of the current block by the height is 2 or more or 1 / 2 or less), the mirror re-arrangement method can be applied to the residual coefficients of the current block, whereas in a case where the width-to-height ratio of the current block is less than 2 and greater than 1 / 2 (i.e., when a value obtained by dividing the width of the current block by the height is less than 2 and greater than 1 / 2), the re-arrangement method of rotating the residual coefficients of the current block by 180 degrees described above can be applied. Or, for example, in a case where the width-to-height ratio of the current block is 2 or more or 1 / 2 or less (i.e., when a value obtained by dividing the width of the current block by the height is 2 or more or 1 / 2 or less), the mirror re-arrangement method described above can be applied to the residual coefficients of the current block, whereas in a case where the width-to-height ratio of the current block is less than 2 and greater than 1 / 2 (i.e., when a value obtained by dividing the width of the current block by the height is less than 2 and 1 / 2), the re-arrangement method described above can not be applied to the residual coefficients of the current block. Meanwhile, the above-described process of determining the re-arrangement method or whether to re-arrange based on a condition can be performed only in a case where the value of the transform skip flag of the current block is 1. In other words, in a case where the value of the transform skip flag of the current block is 1, the re-arrangement method or whether to re-arrange can be determined based on the width-to-height ratio of the current block.

[0333] Alternatively, as another example, when intra prediction is applied to the current block, the re-arrangement method or whether to re-arrange can be determined based on an intra prediction mode of the current block. For example, in a case where a prediction direction of the intra prediction mode of the current block is close to a horizontal direction or a vertical direction, a left reference sample or an above reference sample is mainly used for prediction, such that prediction errors are concentrated in one reference sample direction, and thus, embodiments of determining the re-arrangement method in consideration of this characteristic can be proposed. For example, in a case where the prediction direction of the intra prediction mode of the current block is a horizontal direction or the intra prediction mode of the current block is an intra prediction mode that mainly uses a left reference sample for prediction, the re-arrangement method of vertical flipping described above can be applied, whereas in a case where the prediction direction of the intra prediction mode of the current block is a vertical direction or the intra prediction mode of the current block is an intra prediction mode that mainly uses an above reference sample for prediction, the re-arrangement method of horizontal flipping described above can be applied. Meanwhile, the above-described process of determining the re-arrangement method or whether to re-arrange based on a condition can be performed only in a case where the value of the transform skip flag of the current block is 1. In other words, in a case where the value of the transform skip flag of the current block is 1, the re-arrangement method or whether to re-arrange can be determined based on the intra prediction mode of the current block.

[0334] Alternatively, as another example, the rearrangement method or whether to rearrange can be determined based on a high-level syntax in a bitstream transmitted from the encoding apparatus. For example, a flag indicating whether to rearrange can be transmitted through a high-level syntax such as a sequence parameter set (SPS) or a picture parameter set (PPS), and whether to rearrange and the rearrangement method in a lower syntax referring to the high-level syntax can be determined based on the flag. Meanwhile, for example, the above-described process of determining the rearrangement method or whether to rearrange based on a condition can be performed only when the value of the transform skip flag of the current block is 1. In other words, when the value of the transform skip flag of the current block is 1, a flag indicating whether to rearrange can be transmitted through a high-level syntax such as an SPS or a PPS, and the rearrangement method or whether to rearrange can be determined based on the flag.

[0335] Alternatively, as another example, the rearrangement method or whether to rearrange can be determined based on the prediction mode of the current block. For example, an embodiment in which the residual rearrangement method is not used for an inter prediction mode that relatively less generates a residual signal and the rearrangement method is used only for a residual signal of a block predicted by an intra prediction mode can be proposed. In other words, when inter prediction is applied to the current block, the rearrangement method of the residual coefficients of the current block can not be applied, and when intra prediction is applied to the current block, the rearrangement method of the residual coefficients of the current block can be applied. Meanwhile, for example, the above-described process of determining the rearrangement method or whether to rearrange based on a condition can be performed only when the value of the transform skip flag of the current block is 1. In other words, when the value of the transform skip flag of the current block is 1, the rearrangement method or whether to rearrange can be determined based on the prediction mode of the current block.

[0336] Alternatively, as another example, the rearrangement method or whether to rearrange can be determined based on whether quantization is performed. For example, in lossless coding in which quantization is not applied, the above-described residual rearrangement method can not be performed, and in lossy coding in which quantization is applied, the above-described residual rearrangement method can be performed. In other words, when quantization is not applied to the residual coefficients of the current block, the rearrangement method can not be applied to the residual coefficients of the current block, and when quantization is applied to the residual coefficients of the current block, the rearrangement method can be applied to the residual coefficients of the current block. Meanwhile, for example, the above-described process of determining the rearrangement method or whether to rearrange based on a condition can be performed only when the value of the transform skip flag of the current block is 1. In other words, when the transform skip flag of the current block is 1, the rearrangement method or whether to rearrange can be determined based on whether quantization is applied.

[0337] Meanwhile, as described above, the block for which the transform coding is not performed, i.e., the transform block including the residual coefficients to which the transform is not applied, has different residual information characteristics from the block for which the general transform coding is performed, and thus an efficient residual data coding method is required for the block for which the transform coding is not performed.

[0338] Accordingly, the document proposes embodiments of encoding / decoding residual information about a transform skip block. Here, a transform skip flag indicating whether to apply a transform can be transmitted in units of a transform block, and the size of the transform block is not limited in the embodiments of the document. For example, when the value of the transform skip flag is 1, the method of encoding / decoding residual information proposed in the document can be performed. When the value of the transform skip flag is 0, the method of encoding / decoding the existing residual information such as the syntax elements of the residual information disclosed in Table 1 described above can be performed.

[0339] Figure 15 An example of determining a method of encoding residual information based on a transform skip flag is shown.

[0340] Referring to Figure 16 The encoding apparatus can determine whether the value of the transform skip flag of the current block is 1 (S1500).

[0341] When the value of the transform skip flag is 1, the encoding apparatus can rearrange the residual coefficients of the current block (S1510). Here, as a method of rearranging the residual coefficients, at least one of the embodiments described above can be used. In addition, for example, whether to rearrange the residual coefficients can be determined based on whether the prediction mode of the current block is an inter prediction mode or an intra prediction mode. In addition, for example, in the case where the intra prediction is performed on the current block, a method of rearranging the residual coefficients or whether to rearrange the residual coefficients can be selected based on the intra prediction mode applied to the current block or the distance between the reference sample used in the intra prediction mode and the current block. In addition, for example, a method of rearranging the residual coefficients or whether to rearrange the residual coefficients can be selected based on the size of the current block (e.g., the number of samples of the current block or the width and height of the current block), the shape of the current block (e.g., whether the current block is a square block or a non-square block), the ratio of the horizontal length to the vertical length of the current block, and / or whether quantization is applied to the current block.

[0342] Thereafter, the encoding apparatus can encode information indicating a position of a last non-zero residual coefficient of the current block (S1520). Syntax elements of the information indicating the position of the last non-zero residual coefficient can be last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix.

[0343] Thereafter, the encoding apparatus can encode residual information under the coded_sub_block_flag of the current block, i.e., residual information coded after the coded_sub_block_flag (S1530). For example, the residual information can be encoded together with the syntax elements shown in Table 14 above.

[0344] Meanwhile, when the value of the transform skip flag is 0, the encoding apparatus can encode the residual information of the current block as in the method of the related art (S1540). For example, the residual information encoded as in the scheme of the related art can be the same as the syntax elements disclosed in Table 1 above.

[0345] Meanwhile, the uniform transform type information proposed in Table 10 above can be signaled. A syntax element of the transform type information can be tu_mts_idx. In this case, the method of compiling the residual information can be determined based on the tu_mts_idx. Through the proposed embodiments, the complexity of the process of encoding the residual information can be reduced and the encoding efficiency of the residual information can be improved for blocks for which no transform encoding is performed.

[0346] Figure 16 An example of determining the method of compiling the residual information based on the uniform transform type information is shown.

[0347] Referring to Figure 15 The encoding apparatus can determine whether the value of the uniform transform type information of the current block is 1 (S1600). A syntax element of the uniform transform type information can be tu_mts_idx.

[0348] When the value of the unified transform type information is 1, the encoding apparatus can rearrange the residual coefficients of the current block (S1610). Here, as a method of rearranging the residual coefficients, at least one of the above-described embodiments can be used. In addition, for example, whether to rearrange the residual coefficients can be determined based on whether the prediction mode of the current block is an inter prediction mode or an intra prediction mode. In addition, for example, when intra prediction is performed on the current block, a method for rearranging the residual coefficients or whether to rearrange the residual coefficients can be selected based on an intra prediction mode applied to the current block or a distance between a reference sample for the intra prediction mode and the current block. In addition, for example, based on a size of the current block (e.g., a number of samples of the current block or a width and a height of the current block), a shape of the current block (e.g., whether the current block is a square block or a non-square block), a ratio of a horizontal length to a vertical length of the current block, and / or whether quantization of the current block is applied, a method for rearranging the residual coefficients or whether to rearrange the residual coefficients can be selected.

[0349] Thereafter, the encoding apparatus can encode information indicating a position of a last non-zero residual coefficient of the current block (S1620). Syntax elements indicating the information representing the position of the last non-zero residual coefficient can be last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix.

[0350] Thereafter, the encoding apparatus can encode residual information under the coded_sub_block_flag of the current block, i.e., residual information encoded after the coded_sub_block_flag (S1630). For example, the residual information can be encoded like the syntax elements shown in Table 14 above.

[0351] Meanwhile, when the value of the unified transform type information is 0, the encoding apparatus can encode the residual information of the current block as in the method of the related art (S1640). For example, the residual information encoded like in the method of the related art can be the same as the syntax elements disclosed in Table 1 above. In addition, as disclosed in Table 10 above, the syntax elements transform_skip_flag and / or mts_idx can be omitted. Through the proposed embodiments, the complexity of the process of encoding the residual information for a block for which transform encoding is not performed can be reduced, and the encoding efficiency of the residual information can be improved.

[0352] Meanwhile, the decoding apparatus can derive the residual coefficients of the current block based on the residual information as described above, and determine whether to apply residual rearrangement (residual coefficient rearrangement) to the current block. For example, based on whether the value of the unified transform type information is 1 or 0, the decoding apparatus can determine whether to apply residual rearrangement to the current block.Figure 16 or Figure 17 The value of the transform skip flag (i.e., transform_skip_flag) or the unified transform type information (i.e., tu_mts_idx) shown in the above table can determine whether to apply the residual rearrangement. When the residual rearrangement is applied to the current block, the decoding device can rearrange the residual coefficients based on the residual rearrangement method determined according to the above criteria, and derive the residual samples of the current block based on the rearranged residual coefficients. The rearranged residual coefficients can be derived as the residual samples, or the dequantization can be applied to the rearranged residual coefficients as necessary to derive the residual samples. Thereafter, the reconstructed samples of the current block can be generated based on the residual samples and the prediction samples of the current block as described above.

[0353] Meanwhile, as described above, in the residual coding for the current block, the main syntax elements in the 4x4 size sub-block or 2x2 sub-block unit of the current block can be sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, par_level_flag, abs_level_gtX_flag, and abs_remainder. Among them, the bins of sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, par_level_flag, abs_level_gtX_flag can be context-coded bins coded based on the regular coding engine, and the bin of abs_remainder can be a bypass bin coded based on the bypass coding engine.

[0354] The context-coded bin shows high data dependency because it is coded using an updated probability state and range while processing the previous bin. That is, in the case of the context-coded bin, there can be difficulty in parallel processing since the coding / decoding of the next bin can be performed after the coding / decoding of all the current bins is performed. In addition, the process of deriving the probability interval and determining the current state can take much time. Therefore, the document proposes an embodiment to improve the CABAC processing efficiency by reducing the number of context-coded bins and increasing the number of bypass bins.

[0355] Through the embodiment of the document, the coding process for the syntax element coded as the context-coded bin can be quickly switched to the coding process for the syntax element abs_remainder coded based on the bypass coding engine, i.e., coded as the bypass bin, and the number of context-coded bins can be reduced.

[0356] As an example, the document proposes a method of limiting the number of residual coefficients in the current sub-block that are coded with sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, and par_level_flag. That is, the present example proposes a method of limiting the number of bins assigned to sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, and par_level_flag to a maximum of N. According to this example, residual coding can be performed on the residual coefficients in the current sub-block according to the scan order, and when the number of bins coded with sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, par_level_flag, i.e., the number of context-coded bins, reaches N, if abs_level_gt1_flag is not coded in the subsequent residual coding, abs_level_gtX_flag is also not coded and can be switched to coding for abs_remainder. N can be denoted as the maximum number of context-coded bins.

[0357] For example, N can be derived to be one of 0 to 64 when the current sub-block is a 4x4 size sub-block, and N can be derived to be one of 0 to 16 when the current sub-block is a 2x2 size sub-block. N can be selected by the encoding device. Alternatively, N can be adaptively determined according to the size of the current block and / or the position of the current sub-block in the current block. Alternatively, N can be set to any one of 0 to 64 when the current sub-block is a 4x4 sub-block. N can be set to any value of any one of 0 to 16 when the current sub-block is a 2x2 sub-block.

[0358] In addition, as an example, the document proposes a method of limiting the number of residual coefficients in the current sub-block that are coded with abs_level_gtX_flag. Referring to Table 14 above, a maximum of four abs_level_gtX_flags can be derived for one residual coefficient at the time of residual coding. That is, a maximum of 64 abs_level_gtX_flags can be coded for the current sub-block when the current sub-block is a 4x4 sub-block. A maximum of 16 abs_level_gtX_flags can be coded for the current sub-block when the current sub-block is a 2x2 sub-block.

[0359] Accordingly, the present embodiment proposes a method of performing residual coding on the residual coefficients in the current sub-block to reduce the number of context-coded bins and coding abs_level_gtX_flag as a maximum N. That is, the present embodiment proposes a method of limiting the number of bins allocated for abs_level_gtX_flag to a maximum N. N can be expressed as the maximum number of syntax elements abs_level_gtX_flag. For example, N can be selected by the encoding device. Alternatively, N can be adaptively determined according to the size of the current block and / or the position of the current sub-block in the current block. Alternatively, when the current sub-block is a 4x4 sub-block, N can be set to any one of 0 to 64. When the current sub-block is a 2x2 sub-block, N can be set to any value of any one of 0 to 16. According to the present embodiment, residual coding can be performed on the residual coefficients in the current sub-block according to the scan order, and when the number of syntax elements abs_level_gtX_flag reaches N, residual coding can be switched to coding for abs_remainder thereafter. In other words, residual coding can be performed on the residual coefficients in the current sub-block according to the scan order, and when the number of bins coded with syntax elements abs_level_gtX_flag, i.e., the number of context-coded bins, reaches N, residual coding can be switched to coding for abs_remainder.

[0360] In addition, as an embodiment, the document can propose a method of combining the above-described embodiment of limiting the sum of the number of sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, and par_level_flag with the embodiment of limiting the number of abs_level_gtX_flag. According to this embodiment, the sum of the number of sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, and par_level_flag of the current sub-block can be limited to M, and the number of abs_level_gtX_flag can be limited to N. That is, the present embodiment proposes a method of limiting the sum of bins allocated for sig_coeff_flag, coeff_sign_flag, abs_level_gt1_flag, and par_level_flag to a maximum M and limiting the number of bins allocated for abs_level_gtX_flag to a maximum N. Here, when the current sub-block is a 4x4 sub-block, M and N can each be derived as one of 0 to 64. When the current sub-block is a 2x2 sub-block, M and N can each be derived as one of 0 to 16.

[0361] Figure 17An image encoding method by an encoding device according to this document is schematically illustrated. Figure 2 The method disclosed in the above can be performed by Figure 17 Specifically, for example, Figure 18 S1700 of the above can be performed by a subtracter of the encoding device, S1710 can be performed by a transformer and quantizer of the encoding device, and S1720 to S1740 can be performed by an entropy encoder of the encoding device. In addition, although not illustrated, a process of deriving a prediction sample can be performed by a predictor of the encoding device, and a process of deriving a reconstructed sample of the current block based on the residual sample of the current block and the prediction sample can be performed by an adder of the encoding device, and a process of encoding the prediction information on the current block can be performed by an entropy encoder of the encoding device.

[0362] The encoding device derives a residual sample of the current block (S1700). The encoding device can determine whether to perform inter prediction or intra prediction on the current block, and can determine a specific inter prediction mode or a specific intra prediction mode based on an RD cost. According to the determined mode, the encoding device can derive a prediction sample of the current block and can derive a residual sample by subtracting the prediction sample from an original sample of the current block.

[0363] The encoding device derives a transform coefficient in a current sub-block of the current block based on the residual sample (S1710). The encoding device can derive the transform coefficient based on the residual sample in the current sub-block of the current block.

[0364] For example, the encoding device can determine whether to apply a transform to the residual sample. When the transform is not applied to the residual sample, the encoding device can derive the derived residual sample as the transform coefficient. In addition, when the transform is applied to the residual sample, the encoding device can derive the transform coefficient by performing the transform on the derived residual sample. The transform coefficient can be included in the current sub-block of the current block. The current sub-block can be referred to as a current coefficient group (CG). In addition, the size of the current sub-block of the current block can be a 4x4 size or a 2x2 size. That is, the current sub-block of the current block can include up to 16 non-zero transform coefficients or up to 4 non-zero transform coefficients.

[0365] Meanwhile, the encoding device can generate and encode a transform skip flag indicating whether to apply a transform to the transform coefficient of the current block. The bitstream can include the transform skip flag of the current block. The transform skip flag can indicate whether to apply the transform to the transform coefficient of the current block. That is, the transform skip flag can indicate whether to apply the transform to the transform coefficient. A syntax element representing the transform skip flag can be the above-described transform_skip_flag.

[0366] Meanwhile, when the value of the transform skip flag of the current block is 1, the encoding apparatus can rearrange the transform coefficients. In this case, the encoding apparatus can generate and encode residual information about the rearranged transform coefficients. For example, the encoding apparatus can rearrange the transform coefficients through various rearrangement methods. That is, the encoding apparatus can move the transform coefficients from the derived positions to other positions through various rearrangement methods.

[0367] As an example, the encoding apparatus can rearrange the transform coefficients through a rearrangement method of rotating by 180 degrees. Specifically, for example, the encoding apparatus can rearrange the transform coefficients of the current block to positions symmetrical with respect to the center of the current block.

[0368] Alternatively, as an example, the encoding apparatus can rearrange the transform coefficients through a rearrangement method of anti-diagonal mirroring. Specifically, for example, the encoding apparatus can rearrange the transform coefficients to positions symmetrical with respect to a right-up diagonal line of the current block. Here, the right-up diagonal line can mean a right-up diagonal line passing through the center of the current block.

[0369] Alternatively, as an example, the encoding apparatus can rearrange the transform coefficients through a rearrangement method of main diagonal mirroring. Specifically, for example, the encoding apparatus can rearrange the transform coefficients to positions symmetrical with respect to a left-up diagonal line of the current block. Here, the left-up diagonal line can mean a left-up diagonal line passing through the center of the current block.

[0370] Alternatively, as an example, the encoding apparatus can rearrange the transform coefficients through a rearrangement method of vertical flipping. Specifically, for example, the encoding apparatus can rearrange the transform coefficients of the current block to positions symmetrical with respect to a vertical axis of the current block. Here, the vertical axis can be a vertical line passing through the center of the current block.

[0371] Alternatively, as an example, the encoding apparatus can rearrange the transform coefficients through a rearrangement method of horizontal flipping. The encoding apparatus can rearrange the transform coefficients of the current block to positions symmetrical with respect to a horizontal axis of the current block. Here, the horizontal axis can be a horizontal line passing through the center of the current block.

[0372] Alternatively, as an example, the encoding apparatus can rearrange the transform coefficients through a method of deriving layers distinguished based on distances from reference samples of the current block and rearranging the layers according to an inverse raster order.

[0373] For example, the encoding apparatus can set the tiers for the current block based on distances from reference samples of the current block. Here, the reference samples can include an above reference sample and a left reference sample of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the left reference sample can be p[-1][0] to p[-1][2N-1] and the above reference sample can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 from the nearest reference sample, the second tier can include positions having a distance of 2 from the nearest reference sample, and the Nth tier can include positions having a distance of N from the nearest reference sample.

[0374] Thereafter, the encoding apparatus can scan the transform coefficients in a reverse raster order. In other words, the encoding apparatus can scan the transform coefficients of the current block in a right-to-left and bottom-to-top direction. Next, the encoding apparatus can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in an order of the first tier to the Nth tier. In addition, the transform coefficients can be rearranged based on a horizontal-first scan or a vertical-first scan in the rearranged tiers.

[0375] For example, the transform coefficients can be rearranged horizontally-first at a horizontal position of a top-left position of the rearranged tier, and when a vertical position of the top-left position of the rearranged tier exists, the transform coefficients can be rearranged vertically-downward at the vertical position of the top-left position of the rearranged tier after being rearranged at the horizontal position. Alternatively, for example, the transform coefficients can be rearranged vertically-downward at a vertical position of a top-left position of the rearranged tier, and when a horizontal position of the top-left position of the rearranged tier exists, the transform coefficients can be rearranged left-to-right at the horizontal position of the top-left position of the rearranged tier after being rearranged at the vertical position.

[0376] Alternatively, as an example, the encoding apparatus can rearrange the transform coefficients by a method of deriving tiers distinguished based on distances from reference samples of the current block and rearranging the tiers according to a diagonal scan order.

[0377] For example, the encoding device can set the tiers for the current block based on distances to reference samples of the current block. Here, the reference samples can include an above reference sample and a left reference sample of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the left reference sample can be p[-1][0] to p[-1][2N-1] and the above reference sample can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 to the nearest reference sample, the second tier can include positions having a distance of 2 to the nearest reference sample, and the Nth tier can include positions having a distance of N to the nearest reference sample.

[0378] Thereafter, the encoding device can scan the transform coefficients in a diagonal scan order. In other words, the encoding device can scan the transform coefficients of the current block in a direction from the top-right to the bottom-left and from the bottom-right to the top-left. Next, the encoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in an order of the first tier to the Nth tier. In addition, the transform coefficients can be rearranged based on a horizontal-first scan or a vertical-first scan in the rearranged tiers.

[0379] For example, the transform coefficients can be rearranged from right to left preferentially at a horizontal position of a top-left position of the rearranged tiers, and when a vertical position of the top-left position of the rearranged tiers exists, the transform coefficients can be rearranged from top to bottom at the vertical position of the top-left position of the rearranged tiers after being rearranged at the horizontal position. Alternatively, for example, the transform coefficients can be rearranged from top to bottom preferentially at a vertical position of a top-left position of the rearranged tiers, and when a horizontal position of the top-left position of the rearranged tiers exists, the transform coefficients can be rearranged from left to right at the horizontal position of the top-left position of the rearranged tiers after being rearranged at the vertical position.

[0380] Alternatively, for example, the encoding device can set the tiers for the current block based on distances from upper reference samples of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the upper reference samples can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 from a nearest reference sample, the second tier can include positions having a distance of 2 from the nearest reference sample, and the Nth tier can include positions having a distance of N from the nearest reference sample. In other words, the first tier can be a first row of the current block, the second tier can be a second row of the current block, and the Nth tier can be an Nth row of the current block.

[0381] Thereafter, the encoding device can scan the transform coefficients in a diagonal scan order. In other words, the encoding device can scan the transform coefficients of the current block in a direction from the top-right to the bottom-left and from the bottom-right to the top-left. Next, the encoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in order from the first tier to the Nth tier. The rearrangement of the transform coefficients can be performed in order from the first tier to the Nth tier, and the transform coefficients can be rearranged from right to left at positions of the rearranged tiers.

[0382] Alternatively, for example, the encoding device can set the tiers for the current block based on distances from left reference samples of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the left reference samples can be p[-1][0] to p[-1][2N-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 from a nearest left reference sample, the second tier can include positions having a distance of 2 from the nearest left reference sample, and the Nth tier can include positions having a distance of N from the nearest reference sample. In other words, the first tier can be a first column of the current block, the second tier can be a second column of the current block, and the Nth tier can be an Nth column of the current block.

[0383] Thereafter, the encoding device can scan the transform coefficients in a diagonal scan order. In other words, the encoding device can scan the transform coefficients of the current block in a direction from the top-right to the bottom-left and from the bottom-right to the top-left. Next, the encoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in order from the first tier to the Nth tier. The rearrangement of the transform coefficients can be performed in order from the first tier to the Nth tier, and the transform coefficients can be rearranged from right to left at positions of the rearranged tiers.

[0384] Meanwhile, the encoding apparatus can determine whether to rearrange the transform coefficients based on various conditions. Alternatively, the encoding apparatus can derive a rearrangement method applied to the transform coefficients based on various conditions.

[0385] As an example, the encoding apparatus can determine whether to rearrange the transform coefficients based on a transform skip flag of the current block. The transform skip flag can indicate whether a transform is applied to the transform coefficients. For example, when a value of the transform skip flag is 1, it can be determined that the transform coefficients are to be rearranged. In other words, when the value of the transform skip flag is 1, the encoding apparatus can rearrange the transform coefficients. When the value of the transform skip flag is 0, it can be determined that the transform coefficients are not to be rearranged. In other words, when the value of the transform skip flag is 0, the encoding apparatus can generate and encode residual information about the current block based on the transform coefficients without rearranging the transform coefficients.

[0386] Alternatively, as another example, it can be determined whether to rearrange the transform coefficients based on a number of samples of the current block. For example, when the number of samples of the current block is less than a certain value, it can be determined that the transform coefficients are to be rearranged. In other words, when the number of samples of the current block is less than the certain value, the encoding apparatus can rearrange the transform coefficients. When the number of samples of the current block is greater than or equal to the certain value, it can be determined that the transform coefficients are not to be rearranged. In other words, when the number of samples of the current block is equal to or greater than the certain value, the encoding apparatus can generate and encode residual information about the current block based on the transform coefficients without rearranging the transform coefficients. The certain value can be 64.

[0387] Alternatively, for example, when the number of samples of the current block is less than 64, the encoding apparatus can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees. When the number of samples of the current block is 64 or more, the encoding apparatus can not rearrange the transform coefficients.

[0388] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on the number of samples of the current block.

[0389] For example, when the number of samples of the current block is less than 64, the encoding apparatus can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees, and when the number of samples of the current block is 64 or more, the encoding apparatus can rearrange the transform coefficients by a rearrangement method of mirroring the transform coefficients. Alternatively, as another example, for example, when the number of samples of the current block is less than 64, the encoding apparatus can rearrange the transform coefficients by one of the above rearrangement methods, and when the number of samples of the current block is 64 or more, the encoding apparatus can not rearrange the transform coefficients.

[0390] Alternatively, as another example, it can be determined whether to rearrange the transform coefficients based on a shape of the current block. For example, when the current block is a square block, it can be determined to rearrange the transform coefficients. In other words, when the current block is a square block, the encoding device can rearrange the transform coefficients. When the current block is a non-square block, it can be determined not to rearrange the transform coefficients. In other words, when the current block is a non-square block, the encoding device can generate and encode the residual information on the current block based on the transform coefficients without rearranging the transform coefficients.

[0391] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on a shape of the current block. For example, when the current block is a square block, the encoding device can rearrange the transform coefficients by a mirroring rearrangement method, while when the current block is a non-square block, the encoding device can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees.

[0392] Alternatively, as another example, it can be determined whether to rearrange the transform coefficients based on a ratio of a width to a height of the current block. For example, when the ratio of the width to the height of the current block is 2 or more or 1 / 2 or less (i.e., when a value obtained by dividing the width of the current block by the height is 2 or more or 1 / 2 or less), the encoding device can rearrange the transform coefficients by a mirroring rearrangement method, while when the ratio of the width to the height of the current block is less than 2 and greater than 1 / 2 (i.e., when a value obtained by dividing the width of the current block by the height is less than 2 and greater than 1 / 2), the encoding device can generate and encode the residual information on the current block based on the transform coefficients without rearranging the transform coefficients.

[0393] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on a ratio of a width to a height of the current block. For example, when the ratio of the width to the height of the current block is 2 or more or 1 / 2 or less (i.e., when a value obtained by dividing the width of the current block by the height is 2 or more or 1 / 2 or less), the encoding device can rearrange the transform coefficients by a mirroring rearrangement method, while when the ratio of the width to the height of the current block is less than 2 and greater than 1 / 2 (i.e., when a value obtained by dividing the width of the current block by the height is less than 2 and greater than 1 / 2), the encoding device can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees.

[0394] Alternatively, as another example, whether to rearrange the transform coefficients can be determined based on an intra prediction mode of the current block. For example, when a prediction direction of the intra prediction mode of the current block is a horizontal direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses left reference samples for prediction, the encoding device can rearrange the transform coefficients by a vertical flipping rearrangement method, while in other cases, the encoding device can generate and encode the residual information of the current block based on the transform coefficients without rearranging the transform coefficients. Alternatively, for example, when a prediction direction of the intra prediction mode of the current block is a vertical direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses upper reference samples for prediction, the encoding device can rearrange the transform coefficients by a vertical flipping rearrangement method, while in other cases, the encoding device can generate and encode the residual information of the current block based on the transform coefficients without rearranging the transform coefficients.

[0395] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on an intra prediction mode of the current block. For example, when a prediction direction of the intra prediction mode of the current block is a horizontal direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses left reference samples for prediction, the encoding device can rearrange the transform coefficients by a vertical flipping rearrangement method, while when a prediction direction of the intra prediction mode of the current block is a vertical direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses upper reference samples for prediction, the encoding device can rearrange the transform coefficients by a vertical flipping rearrangement method.

[0396] Alternatively, as another example, whether to rearrange the transform coefficients can be determined based on a flag indicating whether to rearrange the transform coefficients signaled through a high-level syntax. For example, the encoding device can signal the flag indicating whether to rearrange the transform coefficients through a sequence parameter set (SPS) or a picture parameter set (PPS), and determine whether to rearrange the transform coefficients based on the flag.

[0397] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on information indicating the rearrangement method of the transform coefficients signaled through a high-level syntax. For example, the encoding device can signal the information indicating the rearrangement method of the transform coefficients through a sequence parameter set (SPS) or a picture parameter set (PPS), and determine whether to rearrange the transform coefficients based on the information.

[0398] Alternatively, as another example, whether to rearrange the transform coefficients can be determined based on a prediction mode of the current block. For example, when the prediction mode of the current block is intra prediction, it can be determined that the transform coefficients are to be rearranged. In other words, when the prediction mode of the current block is intra prediction, the encoding device can rearrange the transform coefficients. Also, when the prediction mode of the current block is inter prediction, it can be determined that the transform coefficients are not to be rearranged. In other words, when the prediction mode of the current block is inter prediction, the encoding device can generate and encode the residual information on the current block based on the transform coefficients without rearranging the transform coefficients.

[0399] Alternatively, as another example, whether to rearrange the transform coefficients can be determined based on whether the transform coefficients are quantized. For example, when the transform coefficients are applied with quantization, it can be determined that the transform coefficients are to be rearranged. In other words, when the transform coefficients are applied with quantization, the encoding device can rearrange the transform coefficients. Also, when the transform coefficients are not applied with quantization, it can be determined that the transform coefficients are not to be rearranged. In other words, when the transform coefficients are not applied with quantization, the encoding device can not rearrange the transform coefficients.

[0400] The encoding device derives a particular number of context-coded bins of a context syntax element on the current sub-block (S1720). Here, the particular number can represent the maximum value, and the maximum value can be a maximum value of a sum of numbers of context-coded bins of context syntax elements on transform coefficients related to the current sub-block of the current block.

[0401] As an example, the maximum value can be derived in units of transform blocks.

[0402] For example, the maximum value can be set to an arbitrary value. When a size of the current sub-block is 4x4 size, the maximum value can be derived as one of 0 to 64. When the size of the current sub-block is 2x2 size, the maximum value can be derived as one of 0 to 16. For example, the maximum value can be set to 4.

[0403] Alternatively, for example, the maximum value can be derived based on a size of the current block (or the current sub-block in the current block). When the size of the current block (or the current sub-block in the current block) is 4x4, the derived maximum value can be derived as one of 0 to 64, and when the size of the current block (or the current sub-block in the current block) is 2x2 size, the derived maximum value can be derived as one of 0 to 16.

[0404] Alternatively, for example, the maximum value can be derived based on a size of the current block and a position of the current sub-block.

[0405] Also, for example, the maximum value can be derived based on the position information indicating a position of a last non-zero transform coefficient of the current block. For example, the position of the last non-zero transform coefficient can be derived based on the position information, and a length from a position of a starting transform coefficient in a scan order of the current block to the position of the last non-zero transform coefficient can be derived. The maximum value can be derived based on the length. For example, the maximum value can be derived as a value obtained by multiplying the length by 1.75. Meanwhile, here, the length can correspond to a number of samples of the current block. That is, the length can be the number of samples of the current block. For example, when a transform coefficient having a value of 0 is not included in the arrangement of the transform coefficients of the current block, the length can be the number of samples of the current block. In other words, the maximum value can be derived based on the number of samples of the current block. For example, the maximum value can be derived as a value obtained by multiplying the number of samples of the current block by 1.75.

[0406] The encoding apparatus encodes the context syntax elements based on the certain number (S1730). The encoding apparatus can encode the context syntax elements based on a context based on the maximum value.

[0407] For example, the encoding apparatus can encode the context syntax elements of the transform coefficients of the current sub-block of the current block based on the context. The context syntax elements can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a parity level flag on a parity of a transform coefficient level of the transform coefficient, and a first transform coefficient level flag on whether the transform coefficient is greater than a first threshold value and a second transform coefficient level flag on whether the transform coefficient level of the transform coefficient is greater than a second threshold value. Here, the significant coefficient flag can be sig_coeff_flag, the parity level flag can be par_level_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the second transform coefficient level flag can be abs_level_gt3_flag or abs_level_gtx_flag.

[0408] Alternatively, for example, the context syntax elements can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the transform coefficient, a first transform coefficient level flag indicating whether a transform coefficient level is greater than a first threshold value, and a parity level flag on a parity of the transform coefficient level of the transform coefficient. Here, the significant coefficient flag can be sig_coeff_flag, the sign flag can be coeff_sign_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the parity level flag can be par_level_flag.

[0409] Specifically, when the sum of the number of context-coded bins of the context syntax elements of the transform coefficients in the order preceding the transform coefficient in the scan order of the transform coefficients of the current sub-block reaches a maximum value (i.e., is greater than or equal to the maximum value), the signaling and coding of the context syntax elements of the transform coefficient can be omitted (i.e., the context syntax elements of the transform coefficient can not be signaled) and the bypass syntax element coded based on the bypass of the transform coefficient can be coded. The value of the transform coefficient can be derived based on the bypass syntax element coded based on the bypass.

[0410] For example, when the number of context-coded bins of the context syntax elements of the transform coefficients derived before the particular transform coefficient of the current sub-block reaches a particular number, the bypass syntax element of the particular transform coefficient included in the residual information can be coded. The signaling and coding of the context syntax elements of the particular transform coefficient can be omitted. The value of the particular transform coefficient can be derived based on the bypass syntax element.

[0411] For example, when the sum of the number of context-coded bins of the context syntax elements of the #0 transform coefficient to the #n transform coefficient of the current sub-block reaches a maximum value, the signaling and coding of the context syntax elements of the #n+1 transform coefficient of the current sub-block can be omitted, and the bypass syntax element of the #n+1 transform coefficient included in the residual information can be coded.

[0412] That is, for example, when the sum of the number of context-coded bins of the significant coefficient flags, the first transform coefficient level flags, the parity level flags, and the second transform coefficient level flags of the #0 transform coefficient to the #n transform coefficient determined through the scan order among the transform coefficients of the current sub-block reaches a maximum value (i.e., is greater than or equal to the maximum value), the significant coefficient flags, the first transform coefficient level flags, the parity level flags, and the second transform coefficient level flags of the #n+1 transform coefficient determined through the scan order can be omitted, and the bypass syntax element coded based on the bypass of the #n+1 quantized transform coefficient can be coded.

[0413] Alternatively, for example, when the sum of the number of context-coded bins of the significant coefficient flags, the sign flags, the first transform coefficient level flags, and the parity level flags of the #0 transform coefficient to the #n transform coefficient determined through the scan order among the transform coefficients of the current sub-block reaches a maximum value (i.e., is greater than or equal to the maximum value), the signaling and coding of the significant coefficient flags, the sign flags, and the first transform coefficient level flags and the parity level flags of the #n+1 transform coefficient determined through the scan order can be omitted, and the bypass syntax element coded based on the bypass of the #n+1 quantized transform coefficient can be coded.

[0414] The encoding device generates a bitstream including the residual information on the current block, the residual information on the current block including the coded context syntax elements (S1740). For example, the encoding device can output the image information including the residual information as the bitstream.

[0415] For example, the residual information can 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.

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

[0417] In addition, for example, the residual information can include position information indicating a position of a last non-zero transform coefficient in the transform coefficient array of the current block. That is, the residual information can include position information indicating a position of a last non-zero transform coefficient in a scan order of the current block. The position information can include information of a prefix indicating a column position of the last non-zero coefficient, information of a prefix indicating a row position of the last non-zero coefficient, information of a suffix indicating a column position of the last non-zero coefficient, and information of a suffix indicating a row position of the last non-zero coefficient. Syntax elements of the position information can be last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix. Meanwhile, the non-zero transform coefficient can be referred to as a significant coefficient.

[0418] Additionally, for example, the residual information can include context syntax elements of transform coefficients in the current sub-block of the current block. The context syntax elements can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a parity level flag on a parity of a transform coefficient level of the transform coefficient, and a first transform coefficient level flag on whether the transform coefficient level is greater than a first threshold and a second transform coefficient level flag on whether the transform coefficient level of the transform coefficient is greater than a second threshold. Here, the significant coefficient flag can be sig_coeff_flag, the parity level flag can be par_level_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the second transform coefficient level flag can be abs_level_gt3_flag or abs_level_gtx_flag.

[0419] Alternatively, for example, the context syntax elements can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the transform coefficient, a first transform coefficient level flag indicating whether a transform coefficient level is greater than a first threshold, and a parity level flag on a parity of the transform coefficient level of the transform coefficient. Here, the significant coefficient flag can be sig_coeff_flag, the sign flag can be coeff_sign_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the parity level flag can be par_level_flag.

[0420] Additionally, for example, the residual information can include bypass syntax elements compiled based on bypassing of transform coefficients in the current sub-block of the current block. The bypass syntax elements can include coefficient value-related information on a value of the transform coefficient. The coefficient value-related information can be abs_remainder and / or dec_abs_level.

[0421] Meanwhile, the bitstream can include prediction information of the current block. The prediction information can include information on an inter prediction mode or an intra prediction mode performed on the current block. The encoding device can generate the prediction information of the current block and encode the same.

[0422] Meanwhile, the bitstream can be transmitted to a decoding device through a network or a (digital) storage medium. Here, 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, and SSD.

[0423] Figure 17 An encoding device for performing an image encoding method according to the document is schematically illustrated. Figure 18 The method disclosed in the middle can be performed byFigure 18 The encoding device disclosed in the above can perform. Specifically, for example, Figure 17 The subtracter of the encoding device of the above can perform Figure 18 S1700 of the above, Figure 17 The transformer and quantizer of the encoding device of the above can perform Figure 18 S1710 of the above, Figure 17 The entropy encoder of the encoding device of the above can perform Figure 19 S1720 to S1740 of the above. In addition, although not shown, the process of deriving the prediction sample can be performed by the predictor of the encoding device, the process of deriving the reconstructed sample of the current block based on the residual sample of the current block and the prediction sample can be performed by the adder of the encoding device, and the process of encoding the prediction information of the current block can be performed by the entropy encoder of the encoding device.

[0424] Figure 19 An image decoding method by a decoding device according to the above is schematically shown. Figure 3 The method disclosed in the above can be performed by Figure 19 The decoding device disclosed in the above can perform. Specifically, for example, Figure 20 S1900 to S1930 of the above can be performed by the entropy decoder of the decoding device, S1940 can be performed by the dequantizer and inverse transformer of the decoding device, and S1950 can be performed by the adder of the decoding device. In addition, although not shown, the process of deriving the prediction sample can be performed by the predictor of the decoding device.

[0425] The decoding device receives a bitstream including residual information of a current block (S1900). The decoding device can receive image information including residual information about the current block through the bitstream. Here, the current block can be a coding block (CB) or a transform block (TB). The residual information can include syntax elements of a current sub-block in the current block. Here, the syntax elements can include context syntax elements and bypass elements. That is, the residual information can include context syntax elements and bypass syntax elements of the current sub-block. The context syntax elements can indicate syntax elements coded based on a context, and the bypass syntax elements can indicate syntax elements coded in bypass (i.e., syntax elements coded based on a uniform probability distribution).

[0426] For example, the residual information can 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.

[0427] In detail, for example, the residual information can include a transform skip flag of the current block. The transform skip flag can indicate whether a transform is applied to the transform coefficients of the current block. That is, the transform skip flag can indicate whether a transform is applied to the transform coefficients. A syntax element representing the transform skip flag can be the above-described transform_skip_flag.

[0428] In addition, for example, the residual information can include position information indicating a position of a last non-zero transform coefficient in the array of the transform coefficients of the current block. That is, the residual information can include position information indicating a position of a last non-zero transform coefficient in a scan order of the current block. The position information can include information of a prefix indicating a column position of the last non-zero coefficient, information of a prefix indicating a row position of the last non-zero coefficient, information of a suffix indicating the column position of the last non-zero coefficient, and information of a suffix indicating the row position of the last non-zero coefficient. Syntax elements of the position information can be last_sig_coeff_x_prefix, last_sig_coeff_y_prefix, last_sig_coeff_x_suffix, and last_sig_coeff_y_suffix. Meanwhile, the non-zero transform coefficient can be referred to as a significant coefficient.

[0429] Additionally, for example, the residual information can include context syntax elements of transform coefficients in the current sub-block of the current block. The context syntax elements can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a parity level flag on a parity of a transform coefficient level of the transform coefficient, and a first transform coefficient level flag on whether the transform coefficient level is greater than a first threshold and a second transform coefficient level flag on whether the transform coefficient level is greater than a second threshold. Here, the significant coefficient flag can be sig_coeff_flag, the parity level flag can be par_level_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the second transform coefficient level flag can be abs_level_gt3_flag or abs_level_gtx_flag.

[0430] Alternatively, for example, the context syntax elements can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the transform coefficient, a first transform coefficient level flag indicating whether a transform coefficient level is greater than a first threshold, and a parity level flag on a parity of the transform coefficient level of the transform coefficient. Here, the significant coefficient flag can be sig_coeff_flag, the sign flag can be coeff_sign_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the parity level flag can be par_level_flag.

[0431] Additionally, for example, the residual information can include bypass syntax elements compiled based on bypassing of transform coefficients in the current sub-block of the current block. The bypass syntax elements can include coefficient value related information on a value of the transform coefficient. The coefficient value related information can be abs_remainder and / or dec_abs_level.

[0432] Meanwhile, the bitstream can include prediction information of the current block. The prediction information can include information on an inter prediction mode or an intra prediction mode performed on the current block. The decoding device can perform inter prediction or intra prediction on the current block based on the prediction information received through the bitstream, and can derive prediction samples of the current block.

[0433] The decoding device derives a certain number of context-coded bins of the context syntax elements on the current sub-block of the current block (S1910). Here, the certain number can represent the maximum value. That is, the maximum value can be a maximum value of a sum of numbers of context-coded bins of the context syntax elements on the transform coefficients related to the current sub-block of the current block.

[0434] As an example, the maximum value can be derived in units of a transform block.

[0435] For example, the maximum value can be set to an arbitrary value. When the size of the current sub-block is 4x4 size, the maximum value can be derived as one of 0 to 64. When the size of the current sub-block is 2x2 size, the maximum value can be derived as at least one of 0 to 16. For example, the maximum value can be set to 4.

[0436] Alternatively, for example, the maximum value can be derived based on the size of the current block (or the current sub-block in the current block). When the size of the current block (or the current sub-block in the current block) is 4x4, the derived maximum value can be derived as one of 0 to 64, and when the size of the current block (or the current sub-block in the current block) is 2x2 size, the derived maximum value can be derived as one of 0 to 16.

[0437] Alternatively, for example, the maximum value can be derived based on the size of the current block and the position of the current sub-block.

[0438] In addition, for example, the maximum value can be derived based on position information indicating the position of the last non-zero transform coefficient of the current block. For example, the position of the last non-zero transform coefficient can be derived based on the position information, and the length from the position of the starting transform coefficient in the scan order of the current block to the position of the last non-zero transform coefficient can be derived. The maximum value can be derived based on the length. For example, the maximum value can be derived as a value obtained by multiplying the length by 1.75. Meanwhile, here, the length can correspond to the number of samples of the current block. That is, the length can be the number of samples of the current block. For example, when a transform coefficient having a value of 0 is not included in the arrangement of the transform coefficients of the current block, the length can be the number of samples of the current block. In other words, the maximum value can be derived based on the number of samples of the current block. For example, the maximum value can be derived as a value obtained by multiplying the number of samples of the current block by 1.75.

[0439] The decoding device decodes the context syntax elements of the current sub-block included in the residual information based on the certain number (S1920). The decoding device can decode the context syntax elements based on the context based on the maximum value.

[0440] For example, the decoding device can decode, based on a context, a context syntax element of a transform coefficient of a current sub-block of a current block. The context syntax element can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a parity level flag on a parity of a transform coefficient level of the transform coefficient, and a first transform coefficient level flag on whether the transform coefficient is greater than a first threshold and a second transform coefficient level flag on whether the transform coefficient level of the transform coefficient is greater than a second threshold. Here, the significant coefficient flag can be sig_coeff_flag, the parity level flag can be par_level_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the second transform coefficient level flag can be abs_level_gt3_flag or abs_level_gtx_flag.

[0441] Alternatively, for example, the context syntax element can include a significant coefficient flag indicating whether the transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the transform coefficient, a first transform coefficient level flag indicating whether a transform coefficient level is greater than a first threshold, and a parity level flag on a parity of the transform coefficient level of the transform coefficient. Here, the significant coefficient flag can be sig_coeff_flag, the sign flag can be coeff_sign_flag, the first transform coefficient level flag can be abs_level_gt1_flag, and the parity level flag can be par_level_flag.

[0442] Specifically, when a sum of numbers of context-coded bins of context syntax elements of transform coefficients preceding the transform coefficient in an order on a scan order among the transform coefficients of the current sub-block reaches a maximum value (i.e., is greater than or equal to the maximum value), signaling and decoding of the context syntax element of the transform coefficient can be omitted (i.e., the context syntax element of the transform coefficient can not be signaled) and a bypass syntax element coded based on a bypass of the transform coefficient can be decoded, and a value of the transform coefficient can be derived based on the decoded bypass syntax element.

[0443] For example, when a number of context-coded bins of context syntax elements of transform coefficients preceding a particular transform coefficient of the current sub-block reaches a particular number, a bypass syntax element of the particular transform coefficient included in the residual information can be decoded. Signaling and decoding of the context syntax element of the particular transform coefficient can be omitted. A value of the particular transform coefficient can be derived based on the bypass syntax element.

[0444] For example, when the sum of the number of context-coded bins of the context syntax elements of the #0 transform coefficient to the #n transform coefficient of the current sub-block reaches a maximum value, the signaling and decoding of the context syntax elements of the #n+1 transform coefficient of the current sub-block can be omitted, and the bypass syntax element of the #n+1 transform coefficient included in the residual information can be decoded.

[0445] That is, for example, when the sum of the number of context-coded bins of the significant coefficient flags, the first transform coefficient level flags, the parity level flags, and the second transform coefficient level flags of the #0 transform coefficient to the #n transform coefficient determined by the scan order among the transform coefficients of the current sub-block reaches a maximum value (i.e., greater than or equal to the maximum value), the significant coefficient flags, the first transform coefficient level flags, the parity level flags, and the second transform coefficient level flags of the #n+1 transform coefficient determined by the scan order can be omitted, and the bypass syntax element of the #n+1 quantized transform coefficient based on bypass coding can be decoded, and the value of the #n+1 quantized transform coefficient can be derived based on the value of the bypass syntax element.

[0446] Alternatively, for example, when the sum of the context-coded bins of the significant coefficient flags, the sign flags, the first transform coefficient level flags, and the parity level flags of the #0 transform coefficient to the #n transform coefficient determined by the scan order among the transform coefficients of the current sub-block reaches a maximum value (i.e., greater than or equal to the maximum value), the signaling and decoding of the significant coefficient flags, the sign flags, and the first transform coefficient level flags and the parity level flags of the #n+1 transform coefficient determined by the scan order can be omitted, the bypass syntax element of the #n+1 quantized transform coefficient based on bypass coding can be decoded, and the value of the #n+1 quantized transform coefficient can be derived based on the value of the element.

[0447] The decoding device derives the transform coefficient of the current sub-block based on the decoded context syntax elements (S1930).

[0448] The decoding device can derive the value of the transform coefficient based on the value of the context syntax elements of the transform coefficient entropy-decoded. In addition, the residual information can include a sign flag indicating a sign of the transform coefficient. The decoding device can derive the sign of the transform coefficient based on the sign flag. The syntax element representing the sign flag can be coeff_sign_flag. For example, the decoding device can derive the transform coefficient based on the value and the sign of the transform coefficient.

[0449] The decoding device derives the residual sample of the current block based on the transform coefficient (S1940). For example, the decoding device can derive the residual sample of the current block based on the transform coefficient. That is, the decoding device can derive the residual sample of the current sub-block in the current block based on the transform coefficient.

[0450] For example, the decoding device can derive the residual samples of the current block based on the transform coefficients when the value of the transform skip flag of the current block is 1. For example, the decoding device can dequantize the transform coefficients to derive the residual samples of the current block when the value of the transform skip flag of the current block is 1.

[0451] Alternatively, for example, the decoding device can rearrange the transform coefficients and derive the rearranged transform coefficients as the residual samples of the current block when the value of the transform skip flag of the current block is 1. For example, the decoding device can rearrange the transform coefficients by various rearrangement methods. That is, the decoding device can move the transform coefficients from the derived positions to other positions by various rearrangement methods.

[0452] As an example, the decoding device can rearrange the transform coefficients by a 180-degree rotation rearrangement method. Specifically, for example, the decoding device can rearrange the transform coefficients of the current block to positions symmetrical with respect to a center of the current block.

[0453] Alternatively, as an example, the decoding device can rearrange the transform coefficients by an anti-diagonal mirror rearrangement method. Specifically, for example, the decoding device can rearrange the transform coefficients to positions symmetrical with respect to a right-up diagonal line of the current block. Here, the right-up diagonal line can mean a right-up diagonal line passing through the center of the current block.

[0454] Alternatively, as an example, the decoding device can rearrange the transform coefficients by a main diagonal mirror rearrangement method. Specifically, for example, the decoding device can rearrange the transform coefficients to positions symmetrical with respect to a left-up diagonal line of the current block. Here, the left-up diagonal line can mean a left-up diagonal line passing through the center of the current block.

[0455] Alternatively, as an example, the decoding device can rearrange the transform coefficients by a vertical flip rearrangement method. Specifically, for example, the decoding device can rearrange the transform coefficients of the current block to positions symmetrical with respect to a vertical axis of the current block. Here, the vertical axis can be a vertical line passing through the center of the current block.

[0456] Alternatively, as an example, the decoding device can rearrange the transform coefficients by a horizontal flip rearrangement method. The decoding device can rearrange the transform coefficients of the current block to positions symmetrical with respect to a horizontal axis of the current block. Here, the horizontal axis can be a horizontal line passing through the center of the current block.

[0457] Alternatively, as an example, the decoding device can rearrange the transform coefficients by a method of deriving layers distinguished based on distances from reference samples of the current block and rearranging the layers in an inverse raster scan order.

[0458] For example, the decoding device can set the tiers for the current block based on distances from reference samples of the current block. Here, the reference samples can include an above reference sample and a left reference sample of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the left reference sample can be p[-1][0] to p[-1][2N-1] and the above reference sample can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 from the nearest reference sample, the second tier can include positions having a distance of 2 from the nearest reference sample, and the Nth tier can include positions having a distance of N from the nearest reference sample.

[0459] Thereafter, the decoding device can scan the transform coefficients in a reverse raster order. In other words, the decoding device can scan the transform coefficients of the current block in a right-to-left and bottom-up direction. Next, the decoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in an order of the first tier to the Nth tier. In addition, the transform coefficients can be rearranged based on a horizontal-first scan or a vertical-first scan in the rearranged tiers.

[0460] For example, the transform coefficients can be rearranged horizontally-first at a horizontal position of a top-left position of the rearranged tier, and when a vertical position of the top-left position of the rearranged tier exists, the transform coefficients can be rearranged vertically-downward at the vertical position of the top-left position of the rearranged tier after being rearranged at the horizontal position. Alternatively, for example, the transform coefficients can be rearranged vertically-downward at a vertical position of a top-left position of the rearranged tier, and when a horizontal position of the top-left position of the rearranged tier exists, the transform coefficients can be rearranged left-to-right at the horizontal position of the top-left position of the rearranged tier after being rearranged at the vertical position.

[0461] Alternatively, as an example, the decoding device can rearrange the transform coefficients by a method of deriving tiers distinguished based on distances from reference samples of the current block and rearranging the tiers according to a diagonal scan order.

[0462] For example, the decoding device can set the tiers for the current block based on distances to reference samples of the current block. Here, the reference samples can include an above reference sample and a left reference sample of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the left reference sample can be p[-1][0] to p[-1][2N-1] and the above reference sample can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 to the nearest reference sample, the second tier can include positions having a distance of 2 to the nearest reference sample, and the Nth tier can include positions having a distance of N to the nearest reference sample.

[0463] Thereafter, the decoding device can scan the transform coefficients in a diagonal scan order. In other words, the decoding device can scan the transform coefficients of the current block in a direction from the top-right to the bottom-left and from the bottom-right to the top-left. Next, the decoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in an order of the first tier to the Nth tier. In addition, the transform coefficients can be rearranged based on a horizontal-first scan or a vertical-first scan in the rearranged tiers.

[0464] For example, the transform coefficients can be rearranged horizontally-first at a horizontal position of a top-left position of the rearranged tiers, and when a vertical position of the top-left position of the rearranged tiers exists, the transform coefficients can be rearranged vertically-from-top-to-bottom at the vertical position of the top-left position of the rearranged tiers after being rearranged at the horizontal position. Alternatively, for example, the transform coefficients can be rearranged vertically-from-top-to-bottom at a vertical position of a top-left position of the rearranged tiers, and when a horizontal position of the top-left position of the rearranged tiers exists, the transform coefficients can be rearranged horizontally-from-left-to-right at the horizontal position of the top-left position of the rearranged tiers after being rearranged at the vertical position.

[0465] Alternatively, for example, the decoding device can set the tiers for the current block based on distances from top reference samples of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the top reference samples can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 from a nearest reference sample, the second tier can include positions having a distance of 2 from the nearest reference sample, and the Nth tier can include positions having a distance of N from the nearest reference sample. In other words, the first tier can be a first row of the current block, the second tier can be a second row of the current block, and the Nth tier can be an Nth row of the current block.

[0466] Thereafter, the decoding device can scan the transform coefficients in a diagonal scan order. In other words, the decoding device can scan the transform coefficients of the current block in a direction from top-right to bottom-left and from bottom-right to top-left. Next, the decoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in an order of the first tier to the Nth tier. The rearrangement of the transform coefficients can be performed in the order from the first tier to the Nth tier, and the transform coefficients can be rearranged from right to left at positions of the rearranged tiers.

[0467] Alternatively, for example, the decoding device can set the tiers for the current block based on distances from top reference samples of the current block. For example, when a size of the current block is NxN and x and y components of a top-left sample position of the current block are 0, the top reference samples can be p[0][-1] to p[2N-1][-1]. When the size of the current block is NxN, the tiers can include a first tier to an Nth tier. The Nth tier can be a last tier, and N can be equal to a value of a width or a height of the current block. For example, the first tier can include positions having a distance of 1 from a nearest reference sample, the second tier can include positions having a distance of 2 from the nearest reference sample, and the Nth tier can include positions having a distance of N from the nearest reference sample. In other words, the first tier can be a first row of the current block, the second tier can be a second row of the current block, and the Nth tier can be an Nth row of the current block.

[0468] Thereafter, the decoding device can scan the transform coefficients in a diagonal scan order. In other words, the decoding device can scan the transform coefficients of the current block in a direction from top-right to bottom-left and from bottom-right to top-left. Next, the decoding device can rearrange the transform coefficients in the tiers in the scan order. Here, the rearrangement of the transform coefficients can be performed in an order of the first tier to the Nth tier. The rearrangement of the transform coefficients can be performed in the order from the first tier to the Nth tier, and the transform coefficients can be rearranged from right to left at positions of the rearranged tiers.

[0469] Meanwhile, the decoding device can determine whether to rearrange the transform coefficients based on various conditions. Alternatively, the decoding device can derive a rearrangement method applied to the transform coefficients based on various conditions.

[0470] As an example, the decoding device can receive a transform skip flag of the current block and determine whether to rearrange the transform coefficients based on the transform skip flag of the current block. The transform skip flag can indicate whether a transform is applied to the transform coefficients. For example, when a value of the transform skip flag is 1, it can be determined that the transform coefficients are to be rearranged. In other words, when the value of the transform skip flag is 1, the decoding device can rearrange the transform coefficients. When the value of the transform skip flag is 0, it can be determined that the transform coefficients are not to be rearranged. In other words, when the value of the transform skip flag is 0, the decoding device can derive residual samples of the current block based on the transform coefficients without rearranging the transform coefficients.

[0471] Alternatively, as another example, it can be determined whether to rearrange the transform coefficients based on a number of samples of the current block. For example, when the number of samples of the current block is less than a certain value, it can be determined that the transform coefficients are to be rearranged. In other words, when the number of samples of the current block is less than the certain value, the decoding device can rearrange the transform coefficients. When the number of samples of the current block is greater than or equal to the certain value, it can be determined that the transform coefficients are not to be rearranged. In other words, when the number of samples of the current block is equal to or greater than the certain value, the decoding device can generate and encode residual information about the current block based on the transform coefficients without rearranging the transform coefficients. The certain value can be 64.

[0472] Alternatively, for example, when the number of samples of the current block is less than 64, the decoding device can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees. When the number of samples of the current block is 64 or more, the decoding device can not rearrange the transform coefficients.

[0473] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on the number of samples of the current block.

[0474] For example, when the number of samples of the current block is less than 64, the decoding device can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees, and when the number of samples of the current block is 64 or more, the decoding device can rearrange the transform coefficients by a rearrangement method of mirroring the transform coefficients. Alternatively, as another example, for example, when the number of samples of the current block is less than 64, the decoding device can rearrange the transform coefficients by one of the above rearrangement methods, and when the number of samples of the current block is 64 or more, the decoding device can not rearrange the transform coefficients.

[0475] Alternatively, as another example, it can be determined whether to rearrange the transform coefficients based on a shape of the current block. For example, when the current block is a square block, it can be determined to rearrange the transform coefficients. In other words, when the current block is a square block, the decoding device can rearrange the transform coefficients. When the current block is a non-square block, it can be determined not to rearrange the transform coefficients. In other words, when the current block is a non-square block, the decoding device can derive the residual samples of the current block based on the transform coefficients without rearranging the transform coefficients.

[0476] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on a shape of the current block. For example, when the current block is a square block, the decoding device can rearrange the transform coefficients by a mirroring rearrangement method, while when the current block is a non-square block, the decoding device can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees.

[0477] Alternatively, as another example, it can be determined whether to rearrange the transform coefficients based on a ratio of a width to a height of the current block. For example, when the ratio of the width to the height of the current block is 2 or more or 1 / 2 or less (i.e., when a value obtained by dividing the width of the current block by the height is 2 or more or 1 / 2 or less), the decoding device can rearrange the transform coefficients by a mirroring rearrangement method, while when the ratio of the width to the height of the current block is less than 2 and greater than 1 / 2 (i.e., when a value obtained by dividing the width of the current block by the height is less than 2 and greater than 1 / 2), the decoding device can derive the residual samples of the current block based on the transform coefficients without rearranging the transform coefficients.

[0478] Alternatively, as another example, a rearrangement method of the transform coefficients can be determined based on a ratio of a width to a height of the current block. For example, when the ratio of the width to the height of the current block is 2 or more or 1 / 2 or less (i.e., when a value obtained by dividing the width of the current block by the height is 2 or more or 1 / 2 or less), the decoding device can rearrange the transform coefficients by a mirroring rearrangement method, while when the ratio of the width to the height of the current block is less than 2 and greater than 1 / 2 (i.e., when a value obtained by dividing the width of the current block by the height is less than 2 and greater than 1 / 2), the decoding device can rearrange the transform coefficients by a rearrangement method of rotating the transform coefficients by 180 degrees.

[0479] Alternatively, as another example, the determination of whether to rearrange the transform coefficients can be based on the intra prediction mode of the current block. For example, when the prediction direction of the intra prediction mode of the current block is a horizontal direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses left reference samples for prediction, the decoding device can rearrange the transform coefficients by the vertical flipping rearrangement method, and in other cases, the decoding device can derive the residual samples of the current block based on the transform coefficients without rearranging the transform coefficients. Alternatively, for example, when the prediction direction of the intra prediction mode of the current block is a vertical direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses upper reference samples for prediction, the decoding device can rearrange the transform coefficients by the vertical flipping rearrangement method, and in other cases, the decoding device can derive the residual samples of the current block based on the transform coefficients without rearranging the transform coefficients.

[0480] Alternatively, as another example, the determination of the rearrangement method of the transform coefficients can be based on the intra prediction mode of the current block. For example, when the prediction direction of the intra prediction mode of the current block is a horizontal direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses left reference samples for prediction, the decoding device can rearrange the transform coefficients by the vertical flipping rearrangement method, and when the prediction direction of the intra prediction mode of the current block is a vertical direction or when the intra prediction mode of the current block is an intra prediction mode that mainly uses upper reference samples for prediction, the decoding device can rearrange the transform coefficients by the vertical flipping rearrangement method.

[0481] Alternatively, as another example, the determination of whether to rearrange the transform coefficients can be based on a flag indicating whether to rearrange the transform coefficients received through high-level syntax. For example, the decoding device can receive the flag indicating whether to rearrange the transform coefficients through a sequence parameter set (SPS) or a picture parameter set (PPS), and determine whether to rearrange the transform coefficients based on the flag.

[0482] Alternatively, as another example, the determination of the rearrangement method of the transform coefficients can be based on information indicating the rearrangement method of the transform coefficients received through high-level syntax. For example, the decoding device can signal the information indicating the rearrangement method of the transform coefficients through a sequence parameter set (SPS) or a picture parameter set (PPS), and determine whether to rearrange the transform coefficients based on the information.

[0483] Alternatively, as another example, whether to rearrange the transform coefficients can be determined based on a prediction mode of the current block. For example, when the prediction mode of the current block is intra prediction, it can be determined that the transform coefficients are to be rearranged. In other words, when the prediction mode of the current block is intra prediction, the decoding device can rearrange the transform coefficients. Also, when the prediction mode of the current block is inter prediction, it can be determined that the transform coefficients are not to be rearranged. In other words, when the prediction mode of the current block is inter prediction, the decoding device can derive the residual samples of the current block based on the transform coefficients without rearranging the transform coefficients.

[0484] Alternatively, as another example, whether to rearrange the transform coefficients can be determined based on whether the transform coefficients are quantized. For example, when the transform coefficients are quantized, it can be determined that the transform coefficients are to be rearranged. In other words, when the transform coefficients are quantized, the decoding device can rearrange the transform coefficients. Also, when the transform coefficients are not quantized, it can be determined that the transform coefficients are not to be rearranged. In other words, when the transform coefficients are not quantized, the decoding device can derive the residual samples of the current block based on the transform coefficients without rearranging the transform coefficients.

[0485] Alternatively, for example, when the value of the transform skip flag of the current block is 0, the decoding device can inverse transform the transform coefficients to derive the residual samples of the current block. Or, for example, when the value of the transform skip flag of the current block is 0, the decoding device can dequantize the transform coefficients and inverse transform the dequantized coefficients to derive the residual samples of the current block.

[0486] The decoding device generates a reconstructed picture based on the residual samples (S1950). For example, the decoding device can derive prediction samples by performing an inter prediction mode or an intra prediction mode on the current block based on prediction information received through the bitstream, and can generate the reconstructed picture by adding the prediction samples and the residual samples. For example, the prediction information can include information indicating an intra prediction mode of the current block. Alternatively, the prediction information can include motion-related information of the current block.

[0487] Thereafter, in-loop filtering processes such as a deblocking filter, SAO, and / or ALF processes can be applied to the reconstructed picture as necessary in order to improve subjective / objective picture quality as described above.

[0488] Figure 19 A decoding device for performing an image decoding method according to this document is schematically illustrated. Figure 20 The method disclosed in Figure 20 The decoding device disclosed in can be performed. Specifically, for example, Figure 19 The entropy decoder of the decoding device of can perform Figure 20 S1900 to S1930 of can be performed, and Figure 19The dequantizer and inverse converter of the decoding device can perform Figure 20 S1940, Figure 19 The adder of the decoding device can perform Figure 20 S1950. Additionally, although not shown, the process of obtaining prediction information for the current block via a bitstream can be achieved by... Figure 20 The process of executing the entropy decoder of the decoding device and deriving the predicted samples of the current block based on the prediction information can be performed by... Figure 21 The predictor of the decoding device is executed.

[0489] According to the aforementioned document, the efficiency of residual compilation can be improved.

[0490] Additionally, according to the document, the amount of context-based compilation data can be reduced by limiting the sum of the number of context compilation bins of the context syntax elements of the transform coefficients in the current block included in the residual information to a predetermined maximum value or less.

[0491] In addition, according to the document, when adjusting the number of context compilation bins for the current sub-block, it is determined by the sum of the number of context compilation bins for each context syntax element, rather than by compiling for each context syntax element. This reduces residual compilation complexity and improves overall compilation efficiency.

[0492] In the above embodiments, the method is described based on a flowchart having a series of steps or blocks. This disclosure is not limited to the order of the above steps or blocks. Some steps or blocks may be performed in a different order than the other steps or blocks described above, or may be performed simultaneously. Furthermore, those skilled in the art will understand that the steps shown in the flowchart are not exclusive, and may include other steps, or one or more steps in the flowchart may be deleted without affecting the scope of this disclosure.

[0493] The embodiments described in this specification can be executed by being implemented on a processor, microprocessor, controller, or chip. For example, the functional unit shown in each figure can be executed by being implemented on a computer, processor, microprocessor, controller, or chip. In this case, the information for implementation (e.g., information about instructions) or algorithm can be stored in a digital storage medium.

[0494] In addition, the decoding apparatus and the encoding apparatus according to the present disclosure can be included in a multimedia broadcast transmitting / receiving apparatus, a mobile communication terminal, a home theater video apparatus, a digital theater video apparatus, a surveillance camera, a video chat apparatus, a real-time communication apparatus such as a video communication, a mobile streaming apparatus, a storage medium, a camcorder, a VoD service providing apparatus, an over-the-top (OTT) video apparatus, an Internet streaming service providing apparatus, a three-dimensional (3D) video apparatus, a teleconference video apparatus, a transportation user apparatus (e.g., a vehicle user apparatus, an airplane user apparatus, and a ship user apparatus), and a medical video device, and can be used to process a video signal or a data signal. For example, the over-the-top (OTT) video apparatus can include a game console, a Blu-ray player, an Internet access TV, a home theater system, a smart phone, a tablet, a digital video recorder (DVR), etc.

[0495] In addition, the processing method according to the present disclosure can be generated in the form of a program executed by a computer, and can be stored in a computer-readable recording medium. Multimedia data having a data structure according to the present disclosure can also be stored in a computer-readable recording medium. The computer-readable recording medium includes all types of storage devices in which computer-readable data are stored. The computer-readable recording medium can include, for example, a 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. In addition, the computer-readable recording medium includes a medium implemented in the form of a carrier wave (e.g., transmission via the Internet). In addition, a bitstream generated by the encoding method can be stored in a computer-readable recording medium or transmitted through a wired / wireless communication network.

[0496] In addition, the embodiments of the present disclosure can be implemented according to a program code using a computer program product, and the program code can be executed in a computer by the embodiments of the present disclosure. The program code can be stored on a computer-readable carrier.

[0497] ​ A configuration diagram of a content streaming system to which the present disclosure is applied is illustrated.

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

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

[0500] A bitstream can be generated by applying an encoding method or a bitstream generation method of embodiments of the present document, and a streaming server can temporarily store the bitstream in a process of transmitting or receiving the bitstream.

[0501] A streaming server transmits multimedia data to a user device through a web server based on a user request, and the web server serves as a medium for informing a service to a user. When a user requests a desired service from the web server, the web server delivers the request to the streaming server, and the streaming server transmits multimedia data to the user. In this case, the content streaming system can include a separate control server. In this case, the control server is used to control commands / responses between devices within the content streaming system.

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

[0503] Examples of the user device can include a mobile phone, a smart phone, a laptop computer, a digital broadcasting terminal, a personal digital assistant (PDA), a portable multimedia player (PMP), a navigation, a touch screen PC, a tablet PC, an ultrabook, a wearable device (e.g., a smart watch, smart glasses, and a head-mounted display), a digital TV, a desktop computer, a digital signage, and the like. Each server within the content streaming system can operate as a distributed server, in which case data received from each server can be distributed.

Claims

1. An image decoding method performed by a decoding apparatus, comprising: obtaining, from a bitstream, a transform skip flag of a current block; obtaining, from the bitstream, residual information of the current block based on the transform skip flag, wherein the residual information is transform skipped residual information; deriving a particular number of bins of a transform coefficient of the current block decoded using a context model; decoding, based on the particular number, a context syntax element of a current subblock included in the residual information; deriving, based on the decoded context syntax element, a transform coefficient of the current subblock; deriving, based on the transform coefficient, a residual sample of the current block; and generating, based on the residual sample, a reconstructed picture, wherein when a number of bins of transform coefficients of the current subblock decoded using a context model derived before a particular transform coefficient of the current subblock reaches the particular number, a bypass syntax element of the particular transform coefficient included in the residual information is decoded, and wherein the particular number is set based on a width and a height of the current block.

2. The image decoding method of claim 1, wherein, the context syntax element of the particular transform coefficient includes a significant coefficient flag indicating whether the particular transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the particular transform coefficient, a first transform coefficient level flag whether a transform coefficient level of the particular transform coefficient is greater than a first threshold, a parity level flag of a parity of the transform coefficient level, and a second transform coefficient level flag whether the transform coefficient level is greater than a second threshold, wherein the decoding of the context syntax element of the particular transform coefficient is omitted, and wherein the bypass syntax element of the particular transform coefficient is decoded regardless of the second transform coefficient level flag.

3. The image decoding method of claim 1, wherein, the context syntax element includes a significant coefficient flag indicating whether a transform coefficient is a non-zero transform coefficient, a parity level flag of a parity of a transform coefficient level of the transform coefficient, a first transform coefficient level flag whether the transform coefficient level is greater than a first threshold, and a second transform coefficient level flag whether the transform coefficient level is greater than a second threshold.

4. The image decoding method of claim 1, wherein, the context syntax element includes a significant coefficient flag indicating whether a transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the transform coefficient, a first transform coefficient level flag whether a transform coefficient level of the transform coefficient is greater than a first threshold, and a parity level flag of a parity of the transform coefficient level.

5. The image decoding method according to claim 1, wherein a value of the particular transform coefficient is derived based on a value of the decoded bypass syntax element.

6. The image decoding method of claim 1, wherein deriving, based on the transform coefficient, the residual sample of the current block includes: when a value of the transform skip flag is 1, rearranging the transform coefficient; and deriving the residual sample based on the rearranged transform coefficient. the rearranging the transform coefficient includes:

7. The image decoding method according to claim 6, wherein rearranging transform coefficients of the current block to positions that are symmetrical based on a vertical axis of the current block. the rearranging the transform coefficient includes:

8. The image decoding method of claim 6, wherein, rearranging transform coefficients of the current block to positions that are symmetrical based on a horizontal axis of the current block. rearranging the transform coefficients of the current block to positions based on horizontal axis symmetry of the current block.

9. The image decoding method of claim 6, wherein, The rearranging the transform coefficients comprises: setting a layer of the current block based on a distance to a reference sample of the current block; scanning the transform coefficients in a diagonal scan order; and rearranging the transform coefficients in the layer in the scan order, wherein the reference sample comprises an above reference sample and a left reference sample of the current block.

10. An image encoding method performed by an encoding apparatus, comprising: deriving residual samples of a current block; deriving a transform skip flag indicating whether a transform is applied to the current block; deriving transform coefficients of a current sub-block of the current block based on the residual samples and the transform skip flag; deriving a particular number of bins of the current block encoded using a context model; encoding context syntax elements based on the particular number; and generating a bitstream including the transform skip flag and residual information of the current block including the encoded context syntax elements, wherein the residual information is transform skipped residual information, wherein a bypass syntax element of a particular transform coefficient of the current sub-block is encoded included in the residual information when a number of bins of the particular transform coefficient encoded using a context model reaches the particular number, and wherein the particular number is set based on a width and a height of the current block.

11. The image coding method of claim 10, wherein, The context syntax elements comprise a significant coefficient flag indicating whether a transform coefficient is a non-zero transform coefficient, a parity level flag of a transform coefficient level of the transform coefficient, a first transform coefficient level flag indicating whether the transform coefficient level is greater than a first threshold, and a second transform coefficient level flag indicating whether the transform coefficient level is greater than a second threshold.

12. The image encoding method of claim 10, wherein The context syntax elements of the particular transform coefficient comprise a significant coefficient flag indicating whether the particular transform coefficient is a non-zero transform coefficient, a sign flag indicating a sign of the particular transform coefficient, a first transform coefficient level flag indicating whether a transform coefficient level of the particular transform coefficient is greater than a first threshold, a parity level flag of the transform coefficient level, and a second transform coefficient level flag indicating whether the transform coefficient level is greater than a second threshold, wherein the encoding of the context syntax elements of the particular transform coefficient is omitted, and wherein the bypass syntax element of the particular transform coefficient is encoded regardless of the second transform coefficient level flag.

13. A non-transitory computer-readable storage medium storing a computer program and a bitstream, wherein, The computer program, which when executed by one or more processors, implements the method of any of claims 10-12 to generate the bitstream.

14. A method of transmitting a bitstream, comprising, implementing the method of any of claims 10-12 to generate a bitstream; and transmitting the bitstream.

Citation Information

Patent Citations

  • Arithmetic decoding device, arithmetic coding device, image decoding device and image coding device

    CN104380737A

  • Image decoding device and image coding device

    WO2018173862A1