Video decoding method, video encoding method, and computer-readable recording medium

By determining the scanning area and context model in video encoding and decoding, and utilizing the size and shape features of blocks, the low efficiency of entropy encoding and decoding in existing technologies is solved, achieving more efficient video encoding and decoding.

CN116132694BActive Publication Date: 2026-04-24SAMSUNG ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SAMSUNG ELECTRONICS CO LTD
Filing Date
2018-03-30
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing video codecs have low entropy encoding efficiency when encoding high-resolution or high-quality video content, especially in the determination of scanning and context models, where they fail to fully utilize the correlation and shape features of transform coefficients.

Method used

By determining a scan region that includes all valid transform coefficients in the current block and determining the context model based on the size and shape of the block, a quadrilateral scan region and a predetermined scan order are used to improve entropy encoding and decoding efficiency.

Benefits of technology

It improves the entropy encoding and decoding efficiency in the video encoding and decoding process, reduces unnecessary scanning, enhances the correlation utilization of transform coefficients, and improves encoding and decoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116132694B_ABST
    Figure CN116132694B_ABST
Patent Text Reader

Abstract

A video decoding method, a video encoding method, and a computer readable recording medium are disclosed. The method includes determining a scan region including all significant transform coefficients in a current block, scanning information about the transform coefficients in the scan region in a predetermined scan order, performing a binary arithmetic decoding based on the scanned information about the transform coefficients to generate binary arithmetic decoded information, performing a debinarization on the binary arithmetic decoded information to obtain information about the transform coefficients of the current block, performing an inverse quantization and an inverse transform based on the information about the transform coefficients of the current block to generate a residual block of the current block, and restoring the current block based on the generated residual block. According to the disclosed video decoding method, the binary arithmetic decoding is performed using a context model determined based on at least one of a size and a shape of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application "Video Decoding Method and Apparatus Thereof and Video Encoding Method and Apparatus Thereof", filed on March 30, 2018, with application number 201880089530.4. Technical Field

[0002] This involves video decoding and video encoding methods. More specifically, it involves entropy decoding and entropy coding. Background Technology

[0003] With the development and widespread availability of hardware capable of playing and storing high-resolution or high-definition video content, the demand for video codecs that effectively encode or decode high-resolution or high-definition video content is constantly increasing. Existing video codecs encode video using a limited number of encoding methods through tree-based coding units.

[0004] Image data in the spatial domain is transformed into coefficients in the frequency domain using frequency transformation. The video codec divides the image into blocks of predetermined size and encodes the frequency coefficients block by block unit by performing a Discrete Cosine Transform (DCT) on each block, enabling fast frequency transformation computation. Compared to image data in the spatial domain, coefficients in the frequency domain have a form that is easily compressed. In particular, since image pixel values ​​in the spatial domain are represented as prediction errors by the codec's inter-frame or intra-frame prediction, many data points may be transformed to zero when performing frequency transformation on the prediction errors. The video codec reduces the data volume by replacing repeatedly occurring data with data of varying sizes. Summary of the Invention

[0005] Technical issues

[0006] According to various embodiments, the scanning area can be determined based on various factors, information related to coefficients can be scanned, and binarization / debinarization and context-based binary arithmetic encoding / decoding can be performed to improve the efficiency of entropy encoding / decoding.

[0007] According to various embodiments, during entropy encoding and decoding of transform coefficients, a quadrilateral scan region including all valid transform coefficients in the current block can be determined, and the valid transform coefficients in the quadrilateral scan region can be scanned, thereby reducing unnecessary scans; valid transform coefficients that are related to each other are scanned in proximity, thereby improving the efficiency of entropy encoding and decoding. A context model related to the syntax regarding transform coefficients can be determined based on various factors, thereby improving the efficiency of entropy encoding and decoding. In particular, at least one of the block size and block shape can be considered to determine the context model related to the syntax elements regarding transform coefficients, thereby improving the efficiency of entropy encoding and decoding. Furthermore, the scan region can be considered to determine the context model related to the syntax regarding transform coefficients, thereby improving the efficiency of entropy encoding and decoding. Additionally, encoding and decoding of information related to the horizontal and vertical coordinates of a specified scan region can be performed not independently, but rather considering the correlation between the horizontal and vertical coordinates to perform encoding and decoding of the coordinate information of the specified scan region, thereby improving the efficiency of encoding and decoding.

[0008] It may include a computer-readable recording medium having recorded a program for implementing the methods of various embodiments.

[0009] Of course, the technical problems of the various embodiments are not limited to the features described above, and other technical problems not mentioned will be clearly understood by those skilled in the art through the following description.

[0010] Technical solution

[0011] The technical problems of the present invention are not limited to the features described above, and other technical problems not mentioned will be clearly understood by those skilled in the art through the following description.

[0012] A video decoding method according to various embodiments may include the following steps: determining a scanning region including all valid transform coefficients in the current block; scanning information related to the transform coefficients in the scanning region according to a predetermined scanning order; performing binary arithmetic decoding based on the scanned information related to the transform coefficients to generate binary arithmetic decoded information; performing debinarization on the binary arithmetic decoded information to obtain information related to the transform coefficients of the current block; performing inverse quantization and inverse transform based on the information related to the transform coefficients of the current block to generate a residual block of the current block; and recovering the current block based on the generated residual block.

[0013] Binary arithmetic decoding can be performed using a context model that is determined based on at least one of the current block's size and shape.

[0014] The quadrilateral scan region can include all valid transform coefficients of the current block, while the remaining regions within the current block, excluding those in the quadrilateral scan region, can include only 0s that are not valid transform coefficients.

[0015] The scanning region can be a quadrilateral scanning region. The steps for determining the scanning region may include: obtaining information related to the coordinates of the specified quadrilateral scanning region from the bitstream; and determining the quadrilateral scanning region of the transform coefficients in the current block based on the information related to the coordinates of the specified quadrilateral scanning region. The horizontal coordinates of the specified quadrilateral scanning region may indicate the coordinates of the rightmost valid transform coefficient pixel in the current block, and the vertical coordinates of the specified quadrilateral scanning region may indicate the coordinates of the bottommost valid transform coefficient pixel in the current block. The bitstream may include flag information indicating the coordinates of the quadrilateral scanning region. Whether the information includes the difference between the horizontal and vertical coordinate values ​​of the specified quadrilateral scanning area, wherein when the flag information indicates that the difference between the horizontal and vertical coordinate values ​​of the specified quadrilateral scanning area is included, the information related to the coordinates of the specified quadrilateral scanning area may include: information indicating the coordinates for one direction among the horizontal coordinates of the rightmost effective transform coefficient pixel in the current block and the vertical coordinates of the bottommost effective transform coefficient pixel in the current block, and information indicating the difference between the coordinates for the one direction and the coordinates for the other directions.

[0016] The size of the current block can be determined based on at least one of the minimum and maximum values ​​of the current block's height and width. The shape of the current block can be determined based on whether the current block's height and width are the same, whether the height is greater than the width, or whether the width is greater than the height.

[0017] The step of determining a scan region including all valid transform coefficients in the current block may include: when the height and width of the current block are different, generating a swapped current block by exchanging the horizontal and vertical coordinates indicating the positions of the transform coefficients in the current block; and determining a scan region including all valid transform coefficients in the swapped current block, wherein the step of determining a scan region including all valid transform coefficients in the swapped current block may include: when the height and width of the current block are different, exchanging the horizontal and vertical coordinates of the specified scan region, and determining the scan region based on the swapped horizontal and vertical coordinates.

[0018] The bitstream may include information indicating whether flag information is included and information related to the coordinates of a specified scan region. The flag information indicates whether the difference between the horizontal and vertical coordinate values ​​of the specified scan region is included. The information related to the coordinates of the specified scan region may include information related to the horizontal and vertical coordinates of the specified scan region. When the flag information indicates that the difference between the horizontal and vertical coordinate values ​​of a specified quadrilateral scan region is included, the information related to the horizontal and vertical coordinates of the specified scan region may include information indicating the coordinates for one direction in the horizontal and vertical coordinates, and information indicating the difference between the coordinates for said one direction and the coordinates for the remaining directions. The step of determining the scan region including all valid transform coefficients in the interleaved current block may include: when the height and width of the current block are different, interleaving the horizontal and vertical coordinates obtained from the information related to the coordinates of the specified scan region, and determining the scan region based on the interleaved horizontal and vertical coordinates.

[0019] The context model relating to the flag information of the current transform coefficient in the context model can be determined based on at least one of the following: the size of the scan region, the number (count) of coefficients scanned in the scan region before the current transform coefficient in a predetermined scan order, the relative position of the current transform coefficient in the scan region, and whether the current valid transform coefficient is the first transform coefficient among the transform coefficients scanned in the scan region in the predetermined scan order.

[0020] When determining the context model related to the flag information of the current transform coefficient based on the size of the scan region and the number of flag information of transform coefficients scanned before the current transform coefficient according to the predetermined scan order, the context model related to the flag information of the current transform coefficient can be determined based on a predetermined context offset, wherein the predetermined context offset corresponds to the case where the number of flag information of transform coefficients scanned before the current coefficient is less than a predetermined value based on the size of the scan region.

[0021] When determining the context model related to the labeling information of the current transform coefficient based on its relative position in the scan region,

[0022] A context model related to the current transform coefficient can be determined based on a predetermined context offset, wherein the predetermined context offset corresponds to the case where the coordinates of the current transform coefficient are less than a predetermined value based on the coordinates of the position of the specified scan area.

[0023] Information related to the transform coefficients may include at least one of the following: flag information indicating whether the transform coefficients are greater than a predetermined value; remaining level information regarding the absolute value of the valid transform coefficients; sign information of the transform coefficients; and binarization parameter information for inverse binarization of the transform coefficients, wherein the predetermined value may be at least one of 0, 1, and 2.

[0024] A video coding method according to various embodiments may include the following steps: obtaining transform coefficients of a current block; determining a scan region including all valid transform coefficients in the current block; scanning information related to the transform coefficients included in the scan region in a predetermined scan order, and performing binarization based on the scanned transform coefficient-related information to generate binarized information; performing binary arithmetic coding on the binarized information to generate entropy-coded information; and generating a bitstream including the entropy-coded information, wherein binary arithmetic coding may be performed using at least one determined context model based on the size and shape of the current block.

[0025] The scanning area can be a quadrilateral scanning area. Specifying the horizontal coordinates of the quadrilateral scanning area can indicate the coordinates of the rightmost valid transform coefficient pixel in the current block. Specifying the vertical coordinates of the quadrilateral scanning area can indicate the coordinates of the bottommost valid transform coefficient pixel in the current block. The bitstream can include information and flag information related to the coordinates of the specified quadrilateral scanning area. The flag information can indicate whether the information related to the coordinates of the specified quadrilateral scanning area includes the difference between the horizontal and vertical coordinate values ​​of the specified quadrilateral scanning area. When the flag information indicates that the difference between the horizontal and vertical coordinate values ​​of the specified quadrilateral scanning area is included, the information related to the coordinates of the specified quadrilateral scanning area can include information indicating the coordinates of the rightmost valid transform coefficient pixel in the current block and the vertical coordinates of the bottommost valid transform coefficient pixel in the current block, for one direction, and information indicating the difference between the coordinates for said one direction and the coordinates for the other directions.

[0026] A video decoding apparatus according to various embodiments may include: an entropy decoding unit that determines a scanning region including all valid transform coefficients in a current block, scans information related to the transform coefficients in the scanning region in a predetermined scanning order, performs binary arithmetic decoding based on the scanned information related to the transform coefficients to generate binary arithmetic decoded information, and performs debinarization on the binary arithmetic decoded information to obtain information related to the transform coefficients of the current block; and an image restoration unit that performs inverse quantization and inverse transform based on the information related to the transform coefficients of the current block to generate a residual block of the current block, and restores the current block based on the generated residual block, wherein binary arithmetic decoding can be performed using a context model determined based on at least one of the size and shape of the current block.

[0027] A video encoding apparatus according to various embodiments may include: an entropy coding unit that obtains transform coefficients of a current block, determines a scanning region including all valid transform coefficients in the current block, scans information related to the transform coefficients included in the scanning region in a predetermined scanning order, performs binarization based on the scanned transform coefficient-related information to generate binarized information, and performs binary arithmetic coding on the binarized information to generate entropy-coded information; and a bitstream generation unit that generates a bitstream including the entropy-coded information, wherein binary arithmetic coding may be performed using a context model determined based on at least one of the size and shape of the current block.

[0028] It may include a computer-readable recording medium having recorded a program for implementing the methods of various embodiments. Attached Figure Description

[0029] Figure 1a A block diagram of a video decoding apparatus according to various embodiments is shown.

[0030] Figure 1b A flowchart of a video decoding method according to various embodiments is shown.

[0031] Figure 1c A block diagram of a video encoding apparatus according to various embodiments is shown.

[0032] Figure 1d A flowchart of a video encoding method according to various embodiments is shown.

[0033] Figure 1e A block diagram of an image decoding unit according to various embodiments is shown.

[0034] Figure 1f A block diagram of an image encoding unit according to various embodiments is shown.

[0035] Figure 2This is a schematic diagram illustrating a method for scanning transformation coefficients within a block according to an embodiment.

[0036] Figure 3a This is a schematic diagram illustrating a method for scanning transformation coefficients within a block according to an embodiment.

[0037] Figure 3b This is a schematic diagram illustrating the operation of determining a coefficient group (sub-block) within a block according to an embodiment, and the operation performed according to the coefficient group.

[0038] Figure 4 This is a schematic diagram illustrating the process of determining a context model for performing context-based binary arithmetic encoding and decoding on information related to transform coefficients, according to one embodiment.

[0039] Figure 5 This is a schematic diagram illustrating the process of determining a context model for performing context-based binary arithmetic encoding and decoding on information related to transform coefficients, according to another embodiment.

[0040] Figure 6a This is a schematic diagram illustrating a horizontally prioritized zigzag scanning order for scanning information related to transformation coefficients in a block, according to an embodiment.

[0041] Figure 6b This is a schematic diagram illustrating a vertically prioritized zigzag scanning sequence for scanning information related to transformation coefficients in a block, according to an embodiment.

[0042] Figure 6c This is a schematic diagram illustrating the horizontal scanning sequence for scanning information related to transformation coefficients in a block according to an embodiment.

[0043] Figure 6d This is a schematic diagram illustrating the vertical scanning sequence for scanning information related to the transformation coefficients in a block according to an embodiment.

[0044] Figure 6e This is a schematic diagram illustrating a diagonal scanning sequence for scanning information related to transformation coefficients in a block, according to an embodiment.

[0045] Figure 7a This is a schematic diagram illustrating the process of changing the scan area by swapping the horizontal and vertical coordinates of the transformation coefficient pixels in the quadrilateral scan area according to an embodiment.

[0046] Figure 7b This is a schematic diagram illustrating the process of changing the scanning area by interchanging the horizontal and vertical coordinates of transformation coefficient pixels in the scanning area according to an embodiment.

[0047] Figure 8 This is a schematic diagram illustrating a process according to an embodiment of determining a context model related to syntactic element information of transform coefficients in the current block based on at least one of the size and shape of the current block.

[0048] Figures 9a to 9c This is a schematic diagram illustrating a residual coding syntax structure according to one embodiment.

[0049] Figures 9d to 9f This is a schematic diagram illustrating the residual coding syntax structure according to another embodiment.

[0050] Figure 10 The process of determining at least one coding unit by dividing the current coding unit is shown according to one embodiment.

[0051] Figure 11 The process of determining at least one coding unit by dividing non-square-shaped coding units according to one embodiment is shown.

[0052] Figure 12 The process of dividing coding units based on at least one of block shape information and partition shape information according to one embodiment is shown.

[0053] Figure 13 A method for determining a predetermined coding unit from an odd number of coding units according to one embodiment is shown.

[0054] Figure 14 The following is illustrated the order in which multiple coding units are processed when multiple coding units are determined by dividing the current coding unit, according to one embodiment.

[0055] Figure 15 The process of determining that the current coding unit will be divided into an odd number of coding units is shown according to one embodiment when coding units cannot be processed in a predetermined order.

[0056] Figure 16 The process of determining at least one coding unit by dividing a first coding unit according to one embodiment is shown.

[0057] Figure 17 It is shown that, according to one embodiment, when a second coding unit of a non-square shape determined by dividing a first coding unit satisfies predetermined conditions, the shape in which the second coding unit can be divided is limited.

[0058] Figure 18 The process of dividing square-shaped coding units according to one embodiment is illustrated when the division shape information indicates that the unit cannot be divided into four square coding units.

[0059] Figure 19 It is shown that the processing order among multiple coding units according to one embodiment can be changed according to the coding unit partitioning process.

[0060] Figure 20 The process of determining the depth of a coding unit as the shape and size of the coding unit change is illustrated according to one embodiment when coding units are recursively divided to determine multiple coding units.

[0061] Figure 21 The illustration shows a depth that can be determined based on the shape and size of the coding unit, and a part index (hereinafter referred to as PID) for distinguishing the coding unit, according to one embodiment.

[0062] Figure 22 The illustration shows how multiple encoding units are determined based on multiple predetermined data units included in a screen, according to one embodiment.

[0063] Figure 23 A processing block according to one embodiment is shown, which serves as a reference for determining the order of reference coding units included in a frame. Detailed Implementation

[0064] In the following text, “image” can refer to a still image or a moving image of a video, that is, the video itself.

[0065] In the following text, "sample" refers to data assigned to sampling locations in an image, and is the data that is processed. For example, pixels in an image in the spatial domain can be samples.

[0066] In the following text, "Current Block" can refer to the block of an image to be encoded or decoded.

[0067] Figure 1a A block diagram of a video decoding apparatus according to various embodiments is shown.

[0068] The video decoding apparatus 100 according to various embodiments may include an entropy decoding unit 105 and an image restoration unit 120.

[0069] The entropy decoding unit 105 can obtain syntax element information received from the bitstream and perform entropy decoding on the syntax element information. At this time, the syntax element information received from the bitstream can be various syntax element information about the image.

[0070] The entropy decoding unit 105 can obtain syntax element information related to the transform coefficients in the current block from the bitstream, and can perform entropy decoding on the syntax element information related to the transform coefficients in the current block. At this time, the current block can be obtained through reference... Figures 10 to 23 The data unit described is used in the process of encoding / decoding an image.

[0071] The entropy decoding unit 105 can obtain information related to the transform coefficients in the current block by scanning syntax element information related to the transform coefficients in the entropy-decoded current block according to a predetermined scanning order. The predetermined scanning order can be various reverse scanning orders. Here, a reverse scanning order can be the scanning order from the lower right pixel in the block to the transform coefficient pixel at the upper left corner of the block. Scanning the transform coefficients in the order from the upper left transform coefficient pixel to the lower right transform coefficient can be called a forward scanning order, and scanning the transform coefficients in the order from the last transform coefficient at the lower right corner to the upper left transform coefficient can be called a reverse scanning order. The syntax element information related to the transform coefficients in the current block can be flag information indicating whether the transform coefficients in the current block are greater than a predetermined value. In this case, the predetermined value can be an integer value greater than or equal to 0. For example, it can be 0, 1, or 2.

[0072] Furthermore, the syntax element information related to the transform coefficients in the current block can be syntax element information indicating the remaining level absolute value. The remaining level absolute value can represent the difference between the absolute value of the transform coefficient's level and the absolute value of the base level. The absolute value of the base level can be determined based on syntax element information indicating whether the absolute value of the transform coefficient is greater than a predetermined value. For example, the sum of the values ​​of the flags indicating whether the absolute value of the transform coefficient is greater than 0 (or whether the transform coefficient is a valid transform coefficient; where a valid transform coefficient is a transform coefficient whose absolute value is greater than 0) (Greater than 0 flag or sig_coeff_flag; hereinafter referred to as the GTO flag), the flags indicating whether the absolute value of the transform coefficient is greater than 1 (Greater than 1 flag or coeff_abs_level_greater1_flag; hereinafter referred to as the GT1 flag), and the flags indicating whether the absolute value of the transform coefficient is greater than 2 (Greater than 2 flag or coeff_abs_level_greater2_flag; hereinafter referred to as the GT2 flag) can be the absolute values ​​at the basic level. Here, the value of the flag indicating whether the absolute value of the transform coefficient is greater than a predetermined value can be 1, and the value of the flag indicating whether the absolute value of the transform coefficient is less than a predetermined value can be 0. Some of the flags related to the magnitude of the transform coefficient may not be obtained from the bitstream. According to one embodiment, when the flag indicating whether the magnitude of the transform coefficient is greater than n (where n is an integer) is called GTn, the flag indicating whether the magnitude of the transform coefficient is greater than (n+1) is called GT(n+1), and the flag indicating whether the magnitude of the transform coefficient is greater than (n+2) is called GT(n+2), only the flags indicating whether the absolute value of the transform coefficient is greater than the smaller n or n+1 among the reference values ​​of n, n+1, and n+2 (i.e., GTn and GT(n+1)) can be transmitted, without including GT(n+2) in the bitstream.

[0073] For example, when the GT0 flag information and the GT1 flag information indicate that the absolute value of the transform coefficient is greater than 0 and 1 respectively, when the GT2 flag information is not included in the bitstream, the GT2 flag information is excluded and only the GT0 flag information and the GT1 flag information are used. Therefore, the absolute value of the transform coefficient is greater than 1. So the entropy decoding unit 105 determines the remaining absolute value of the transform coefficient as the remaining level absolute value of the transform coefficient by subtracting 2 from the absolute value of the transform coefficient.

[0074] When the GT0, GT1, and GT2 flags represent values ​​greater than 0, 1, and 2, respectively, since the absolute value of the transform coefficients is greater than 2, the entropy decoding unit 105 can determine the remaining absolute value of the transform coefficients as the residual level absolute value by subtracting 3 from the absolute value of the transform coefficients. In other words, the residual level absolute value can indicate the difference between the absolute value of the effective transform coefficients and the predetermined absolute value determined based on information indicating whether the absolute value of the transform coefficients is greater than a predetermined value. The entropy decoding unit 105 can obtain the syntax element information received from the bitstream and perform binary arithmetic decoding on the syntax element information, and perform inverse binarization on the output (i.e., the binary string) generated by performing binary arithmetic decoding. The binary arithmetic decoding operation can be performed by the binary arithmetic decoding unit 110, and the inverse binarization operation can be performed by the inverse binarization unit 115.

[0075] Binary arithmetic decoding unit 110 can perform binary arithmetic decoding based on a predetermined context model on syntax element information obtained from the bitstream. Here, the context model can be information related to the occurrence probability of a binary symbol (bin). The information related to the occurrence probability of a binary symbol (bin) can include information (valMPS) indicating one of the symbols with a relatively low occurrence probability between the two symbols 0 and 1 (i.e., the least probable symbol (LPS)) and the opposite, a symbol with a high occurrence probability (i.e., the most probable symbol (MPS)), as well as information related to the occurrence probability of a symbol. The occurrence probability has a value between 0 and 1. Therefore, when the probability of one symbol in MPS and LPS is determined, since the information related to the occurrence probability of the other symbol is information about the probability of subtracting the occurrence probability related to the determined symbol from 1, the binary arithmetic decoding unit 110 can determine the occurrence probabilities for the remaining symbols when the occurrence probability for one symbol is determined. At this time, the occurrence probability for the previously determined symbol can be the occurrence probability of LPS. The probability of occurrence of a symbol corresponding to an index value can be predetermined in the table, and the probability of occurrence information related to the symbol can be information pStateIdx indicating the index of the determined symbol in the table.

[0076] A predetermined context model can be determined based on the bin index indicating the bin position, the probability of the occurrence of a bin in the surrounding blocks of the bin, and various elements of the current block or surrounding blocks.

[0077] Alternatively, the binary arithmetic decoding unit 110 can perform binary arithmetic decoding on the syntax element information obtained from the bitstream according to the bypass mode. In this case, for the currently binary-decoded binary (bin), the probability of obtaining 0 or 1 is fixed at 0.5, and binary arithmetic decoding can be performed on the syntax element information based on this probability.

[0078] The debinarization unit 115 can perform debinarization on a binary string that is the output value generated by performing binary arithmetic decoding. The debinarization unit 115 can perform debinarization on the binary string using a debinarization method corresponding to a predetermined binarization method. The predetermined binarization method may include a fixed-length binarization method, a Rice binarization method, an Exponential-Golomb binarization method, and a Golomb-Rice binarization method. Alternatively, the predetermined binarization method may be a combination of a first binarization method and a second binarization method. For example, the debinarization unit 115 can perform debinarization on a first binary string that is a part of a binary string that is a grammar element using a debinarization method corresponding to the first binarization method, and can perform debinarization on a second binary string that is a part of a binary string that is a grammar element using a debinarization method corresponding to the second binarization method. The binary string of the aforementioned part can be a prefix or suffix of the binary string of the syntax element.

[0079] Both binarization and debinarization methods involve a codeword that specifies a 1:1 correspondence between binary strings containing at least one binary value corresponding to the value of a syntax element. In terms of encoding, a binary string containing at least one binary value corresponding to the value of a syntax element can be determined according to one of the various binarization methods described above, and in terms of decoding, the value of the syntax element corresponding to the binary string can be determined according to the debinarization method. For example, when determining a binary string A corresponding to the value a (a is a real number) of a syntax element according to a predetermined binarization / debinarization method, the process of determining the binary string A based on the value a of the syntax element can be called binarization, and the process of determining the value a of the syntax element based on the binary string A can be called debinarization. However, as mentioned above, binarization and debinarization essentially define the mapping relationship between the value of a syntax element and the binary string, and those skilled in the art can easily understand that binarization and debinarization are essentially the same.

[0080] The entropy decoding unit 105 can obtain information related to the transform coefficients in the current block by scanning syntax element information related to the transform coefficients in the current block according to a predetermined scanning order and performing entropy decoding on it. The predetermined scanning order can be the order of a zigzag scan in the reverse direction or the order of a diagonal scan in the reverse direction. However, it is not limited to this; the predetermined scanning order can be various scanning orders, such as the order of a horizontal scan in the reverse direction or the order of a vertical scan. The predetermined scanning order can be determined based on at least one of the horizontal coordinate (e.g., the x-coordinate (x is an integer)) of the rightmost valid transform coefficient pixel in the current block and the vertical coordinate (e.g., the y-coordinate (y is an integer)) of the bottommost valid transform coefficient pixel in the current block. For example, the entropy decoding unit 105 can determine the predetermined scanning order based on the magnitude of the horizontal coordinate value and the magnitude of the vertical coordinate value. When the horizontal coordinate value is greater than the vertical coordinate value, the entropy decoding unit 105 can determine the vertical scan order in the reverse direction as the predetermined scanning order. When the coordinate value in the vertical direction is greater than the coordinate value in the horizontal direction, the entropy decoding unit 105 can determine the horizontal scanning sequence in the reverse direction as the predetermined scanning sequence.

[0081] Alternatively, when the horizontal coordinate value is greater than the vertical coordinate value, the entropy decoding unit 105 can determine the vertical first zigzag scan order as the predetermined scan order. (Refer to...) Figure 6b The vertical-first zigzag scan order is described in detail. When the vertical coordinate value is greater than the horizontal coordinate value, the entropy decoding unit 105 can determine the horizontal first zigzag scan order (in the opposite direction) as the predetermined scan order. (Refer to...) Figure 6a The horizontal priority zigzag scanning order is described in detail. When the vertical coordinate value is greater than the horizontal coordinate value, the entropy decoding unit 105 can determine one of the reverse vertical priority zigzag scanning order and the horizontal priority zigzag scanning order as the predetermined scanning order.

[0082] Alternatively, when the horizontal coordinate value is greater than the vertical coordinate value, the entropy decoding unit 105 can determine the horizontal first zigzag scan order as the predetermined scan order. When the horizontal coordinate value is greater than the vertical coordinate value, the entropy decoding unit 105 can determine the vertical first zigzag scan order as the predetermined scan order.

[0083] Before scanning information related to transform coefficients, the entropy decoding unit 105 can determine a scan region that includes all valid transform coefficients in the current block. At this time, the scan region can include all valid transform coefficients in the current block, and the remaining regions in the current block, excluding the scan region, can include only transform coefficients that are not valid transform coefficients and are zero. When scanning is performed from the upper left end of the scan region according to a predetermined forward scanning order, the scan region can be a region that includes transform coefficients up to the last scanned valid transform coefficient (hereinafter referred to as the last valid transform coefficient). At this time, the coordinates of the specified scan region can be the coordinates of the last scanned valid transform coefficient pixel.

[0084] The entropy decoding unit 105 can obtain information related to the coordinates indicating the last valid transform coefficient from the bitstream, and determine the scanning area based on the information related to the coordinates indicating the last valid transform coefficient. For example, the entropy decoding unit 105 can obtain information about the horizontal coordinate value indicating the last valid transform coefficient and information about the vertical coordinate value indicating the last valid transform coefficient from the bitstream. At this time, binary arithmetic decoding can be performed on each piece of information to obtain a binary string related to each piece of information, and an inverse binarization method corresponding to a predetermined binarization method can be used on each binary string to obtain the horizontal coordinate value and the vertical coordinate value of the last valid transform coefficient.

[0085] The entropy decoding unit 105 can perform a first inverse binarization method on a first binary string that is part of a binary string to obtain a first value, and perform a second inverse binarization method on a second binary string that is another part of the binary string to obtain a second value. Based on the first and second values, the horizontal coordinates and vertical coordinates of the last effective transform coefficients can be obtained. Here, the first binary string can be a prefix, and the first inverse binarization method can be an inverse binarization method corresponding to a fixed-length binarization method. The second binary string can be a suffix, and the second inverse binarization method can be an inverse binarization method corresponding to a truncated unary code binarization method.

[0086] Alternatively, the scan area can be a quadrilateral scan area, which can be a region specified by the horizontal coordinates of the rightmost valid transform coefficient pixel in the current block and the vertical coordinates of the bottommost valid transform coefficient pixel in the current block.

[0087] The entropy decoding unit 105 can obtain information related to the coordinates of a specified quadrilateral scanning region from the bitstream, and determine the quadrilateral scanning region based on the obtained information related to the coordinates of the specified quadrilateral scanning region. For example, the entropy decoding unit 105 can obtain information from the bitstream indicating the horizontal coordinate value of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block, and information indicating the vertical coordinate value of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block. At this time, the entropy decoding unit 105 can perform binary arithmetic decoding on each piece of information to obtain a binary string related to each piece of information, and use an inverse binarization method corresponding to a predetermined binarization method on the binary string to obtain the horizontal coordinate value of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block and the vertical coordinate value of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block. The entropy decoding unit 105 can perform a first inverse binarization method on a first binary string that is part of a binary string to obtain a first value, and perform a second inverse binarization method on a second binary string that is another part of a binary string to obtain a second value. The horizontal coordinates of the rightmost valid transform coefficient pixel and the vertical coordinates of the bottommost valid transform coefficient pixel in the current block can be obtained based on the first and second values. In this case, the first binary string can be a prefix, and the first inverse binarization method can be an inverse binarization method corresponding to a fixed-length binarization method. The second binary string can be a suffix, and the second inverse binarization method can be an inverse binarization method corresponding to a truncated unary code binarization method.

[0088] Alternatively, the entropy decoding unit 105 can obtain information from the bitstream indicating the coordinates of either the rightmost valid transform coefficient pixel in the current block (horizontal) or the bottommost valid transform coefficient pixel in the current block (vertical), and information indicating the difference between the coordinates in said direction and the coordinates in the remaining directions. The entropy decoding unit 105 can determine said direction based on the height and width of the current block.

[0089] The entropy decoding unit 105 can obtain flag information from the bitstream, which indicates whether information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in other directions is obtained from the bitstream. When the flag information indicates that information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in other directions is obtained from the bitstream, the entropy decoding unit 105 can obtain information from the bitstream indicating the coordinate value in one direction of either the horizontal coordinate value (or the horizontal coordinate value of the last valid transform coefficient pixel) of the rightmost valid transform coefficient pixel in the current block or the vertical coordinate value (or the vertical coordinate value of the last valid transform coefficient pixel) of the bottommost valid transform coefficient pixel in the current block, as well as information indicating the difference between the coordinate value in that direction and the coordinate values ​​in other directions.

[0090] When the flag information indicates that the difference between the coordinate values ​​in one direction and the coordinate values ​​in the other directions is not obtained from the bitstream, the entropy decoding unit 105 can obtain from the bitstream the horizontal coordinate value of the rightmost valid transform coefficient pixel in the current block and the vertical coordinate value of the bottommost valid transform coefficient pixel in the current block.

[0091] Additionally, the entropy decoding unit 105 can determine whether to obtain flag information based on the width and height of the current block. This flag information indicates whether information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in the other directions is obtained from the bitstream. For example, when the width and height of the current block are different (i.e., in the case of a rectangle), the entropy decoding unit 105 can determine whether to obtain flag information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in the other directions is obtained from the bitstream.

[0092] For example, the entropy decoding unit 105 can obtain the coordinate value SR_x indicating the horizontal direction and the coordinate value SR_y indicating the vertical direction according to the next pseudo code 1, so as to specify the scanning area.

[0093] [Pseudocode 1]

[0094]

[0095] According to pseudocode 1, the entropy decoding unit 105 can initialize the variables isXfirst (indicating whether to first decode information related to horizontal coordinate values) and isYfirst (indicating whether to first decode information related to vertical coordinate values) to 0. Additionally, the entropy decoding unit 105 can initialize the flag information srDeltaFlag to 0, which indicates whether information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in the other directions has been obtained.

[0096] When the width W of the current block is greater than the height H of the current block, or the height H of the current block is greater than the width W of the current block, the entropy decoding unit 105 can obtain srDeltFlag from the bit stream and perform decoding on srDeltFlag.

[0097] When the value of the decoded srDeltaFlag is 1 (i.e., when the information indicating the difference between the coordinate values ​​in one direction and the coordinate values ​​in the other directions is obtained), the entropy decoding unit 105 can determine the value of isXfirst to be 1 when the width W of the current block is less than the height H of the current block.

[0098] When the value of the decoded srDeltaFlag is 1 (i.e., when the information indicating the difference between the coordinate values ​​in one direction and the coordinate values ​​in the other directions is received), the entropy decoding unit 105 can determine the value of isYfirst to be 1 when the width W of the current block is greater than the height H of the current block.

[0099] When isXfirst is 1 (indicating that information related to the horizontal coordinate value is decoded first), the entropy decoding unit 105 can obtain information Sr_x indicating the horizontal coordinate value and information (Sr_delta)(Sr_y-Sr_x) indicating the difference between the vertical coordinate value and the horizontal coordinate value from the bitstream, and decode the obtained information. At this time, the vertical coordinate value Sr_y can be determined as Sr_x+Sr_delta.

[0100] When isYfirst is 1 (indicating that information related to the vertical coordinate value is decoded first), the entropy decoding unit 105 can obtain information Sr_y indicating the vertical coordinate value and information (Sr_delta)(Sr_x-Sr_y) indicating the difference between the horizontal and vertical coordinate values ​​from the bitstream, and decode the obtained information. At this time, the vertical coordinate value Sr_y can be determined as Sr_y+Sr_delta.

[0101] When the value of the decoded srDeltaFlag is 0 (that is, when the information indicating the difference between the coordinate values ​​in one direction and the coordinate values ​​in the other directions is not obtained), the entropy decoding unit 105 can obtain the information Sr_x indicating the coordinate value in the horizontal direction and the information Sr_y indicating the coordinate value in the vertical direction from the bit stream and decode the obtained information.

[0102] The entropy decoding unit 105 can determine the context model used in binary arithmetic decoding of all syntax element information for coefficient decoding based on at least one of the current block's size and shape. For example, the size of the current block can be determined based on at least one of the minimum and maximum values ​​of the current block's height and width. The shape of the current block can be determined based on whether the current block's width and height are the same. All syntax element information for coefficient decoding can include syntax element information for specifying the scan region and information related to the transform coefficients in the scan region.

[0103] For example, the entropy decoding unit 105 can determine the information size_tu1 related to the size of the current block based on the following equation 1.

[0104] Equation 1

[0105]

[0106] At this point, log2_width can be the value of log2 of the width W of the current block, and log2_height can be the value of log2 of the height H of the current block.

[0107] The entropy decoding unit 105 can determine the context model corresponding to the information size_tu1 related to the size of the current block, and determine the context model related to the syntax element information used for coefficient decoding, and use the context model to perform binary arithmetic decoding on the syntax element information used for coefficient decoding.

[0108] Alternatively, the video decoding device 100 may determine the information size_tu2 related to the size of the current block based on the following equation 2.

[0109] Equation 2

[0110]

[0111] The entropy decoding unit 105 can determine the context model based on the information size_tu2 related to the size of the current block, and determine the context model related to the syntax element information used for coefficient decoding, and use the context model to perform binary arithmetic decoding on the syntax element information used for coefficient decoding.

[0112] Alternatively, the entropy decoding unit 105 may determine the context model based on the information size_tu1 and size_tu2 related to the size of the current block, and determine the context model related to the syntax element information used for coefficient decoding, and use the context model to perform binary arithmetic decoding on the syntax element information used for coefficient decoding.

[0113] The entropy decoding unit 105 can determine which of the current block's size and height is the minimum and maximum value, determine the context model based on the minimum and maximum values ​​of the current block's size and height, determine the context model related to the syntax element information used for coefficient decoding, and use the context model to perform binary arithmetic decoding on the syntax element information used for coefficient decoding.

[0114] In addition, the entropy decoding unit 105 can determine the context model used in the binary arithmetic decoding of all syntax elements used for coefficient decoding based on the shape of the current block.

[0115] For example, the entropy decoding unit 105 can determine the information shape_tu related to the shape of the current block based on the following equation 3.

[0116] Equation 3

[0117]

[0118] According to [Equation 3], the entropy decoding unit 105 can determine shape_tu as 2 when the width of the current block is greater than its height, determine shape_tu as 1 when the width of the current block is less than its height, and determine shape_tu as 0 when the width of the current block is equal to its height. In other words, in the case of a rectangle whose width is greater than its height, shape_tu can be determined as 2; in the case of a rectangle whose height is greater than its width, shape_tu can be determined as 1; and in the case of a square, shape_tu can be determined as 0.

[0119] The entropy decoding unit 105 can determine the context model based on the information shape_tu related to the shape of the current block, and determine the context model related to the syntax element information used for coefficient decoding, and use the context model to perform binary arithmetic decoding on the syntax element information used for coefficient decoding.

[0120] The entropy decoding unit 105 can determine a context model related to the syntax element information used for coefficient decoding based on the size and shape of the current block. For example, the video decoding apparatus 100 can determine a context model related to the syntax element information used for coefficient decoding based on at least one of the information size_tu1 and size_tu2 related to the size of the current block and the information shape_tu related to the shape of the current block, and use the context model to perform binary arithmetic decoding on the syntax element information used for coefficient decoding.

[0121] When the height and width of the current block are different, i.e., when one of the height and width is larger, the entropy decoding unit 105 can change the height and width of the current block. In other words, the horizontal and vertical coordinates of the pixels included in the current block can be swapped. For example, when the width of the current block is greater than its height, the entropy decoding unit 105 can swap the height and width of the current block. In other words, the horizontal and vertical coordinate values ​​of the pixels included in the current block can be swapped. Furthermore, when the width of the current block is not greater than its height, the entropy decoding unit 105 may not swap the horizontal and vertical coordinates of the pixels included in the current block. However, it is not limited to this; when the height of the current block is greater than its width, the entropy decoding unit 105 can swap the height and width of the current block. In other words, the horizontal and vertical coordinate values ​​of the pixels included in the current block can be swapped. When the horizontal and vertical coordinates of pixels included in the current block are interchanged, the entropy decoding unit 105 can obtain information related to the horizontal and vertical coordinates of a specified scan region from the bitstream, and interchange the horizontal and vertical coordinates of the specified scan region. The entropy decoding unit 105 can determine a first scan region in the swapped current block based on the coordinates of the swapped specified scan region. The entropy decoding unit 105 can scan information related to the transform coefficients included in the first scan region, and obtain the first transform coefficients of the swapped current block based on the scanned information related to the transform coefficients. When the horizontal and vertical coordinates of pixels included in the current block are interchanged, the entropy decoding unit 105 can obtain a second transform coefficient in the current block by interchangering the horizontal and vertical coordinates of the first transform coefficient in the swapped current block. The entropy decoding unit 105 can generate a residual block of the current block by performing inverse quantization and inverse transform on the second transform coefficient of the current block.

[0122] For example, the entropy decoding unit 105 can interchange the horizontal coordinates Sr_x or last_x and the vertical coordinates Sr_y or last_y of the specified scanning area according to the pseudocode 2.

[0123] [Pseudocode 2]

[0124]

[0125] According to pseudocode 2, when the width TU_width of the current block's Transform Unit (TU) is greater than the height TU_height of the current block's TU, the entropy decoding unit 105 can swap the width TU_width and the height TU_height of the current block's TU. During this swapping process, the horizontal and vertical coordinates of the four corners, determined based on the TU's height and width, can also be swapped. Furthermore, the horizontal and vertical coordinates of the pixels included in the TU can also be swapped. At this point, the entropy decoding unit 105 can set the value of swap_flag, which indicates whether the TU's height and width have been swapped, to 1.

[0126] When the width TU_width of the TU that is the current block is not greater than the height TU_height of the TU that is the current block, the entropy decoding units 105 may not swap the width TU_width and the height TU_height of the TU that is the current block.

[0127] At this point, the entropy decoding unit 105 can determine the value of swap_flag, which indicates whether the height and width of the TU are interchanged, to be 0.

[0128] In order to specify the scanning area, the entropy decoding unit 105 can parse information from the bitstream related to the coordinates [Sr_x, Sr_y] used to specify the quadrilateral scanning area, or it can parse information related to the coordinates [last_x, last_y] of the effective transform coefficients that were last scanned in the TU according to the positive direction scanning order.

[0129] When the value of swap_flag is 1, the entropy decoding unit 105 can swap the coordinates [Sr_x, Sr_y] used to specify the quadrilateral scan region with each other, or can swap the coordinates [last_x, last_y] of the effective transformation coefficients in the TU that were last scanned according to the positive direction scan order.

[0130] For example, the entropy decoding unit 105 can interchange the horizontal coordinates Sr_x or last_x and the vertical coordinates Sr_y or last_y of the specified scanning area according to the pseudocode 3.

[0131] [Pseudocode 3]

[0132]

[0133] According to pseudocode 3, when the width TU_width of the current block TU (transformation unit) is greater than the height TU_height of the current block TU, the entropy decoding unit 105 can swap the width TU_width and the height TU_height of the current block TU. During the swapping of the TU's height and width, the horizontal and vertical coordinates of the four corners, determined based on the TU's height and width, can be swapped. Furthermore, the horizontal and vertical coordinates of the pixels included in the TU can also be swapped. At this time, the entropy decoding unit 105 can set the value of swap_flag, which indicates whether the TU's height and width have been swapped, to 1.

[0134] When the width TU_width of the current block is not greater than the height TU_height of the current block, the entropy decoding unit 105 may not swap the width TU_width and the height TU_height of the current block. In this case, the entropy decoding unit 105 may set the value of swap_flag, which indicates whether the height and width of the TU are swapped, to 0.

[0135] The entropy decoding unit 105 can parse the flag deltaXYflag from the bitstream using the difference information between the horizontal and vertical coordinate values ​​of the specified scanning area. This flag indicates whether the horizontal and vertical coordinate values ​​of the specified scanning area have been obtained. In the video encoding apparatus, when the vertical coordinate is greater than the horizontal coordinate, the flag deltaXYflag can be generated with a value of 1; otherwise, it can be generated with a value of 0. When deltaXYflag is 0, the entropy decoding unit 105 can separately obtain information related to the horizontal and vertical coordinate values ​​and perform entropy decoding on the obtained information, and can obtain the coordinates of the specified scanning area based on the entropy-decoded information.

[0136] When the value of deltaXYflag is 1, the entropy decoding unit 105 can parse coordinate information used to specify the scan region from the bitstream. For example, the entropy decoding unit 105 can parse information Sr_x related to the horizontal coordinate values ​​and Sr_xy_delta related to the difference between the horizontal and vertical coordinate values ​​to specify the quadrilateral scan region from the bitstream. Alternatively, to specify the scan region, the entropy decoding unit 105 can parse information last_x related to the horizontal coordinates of the effective transform coefficients last scanned in the positive direction scan order in the TU, and last_xy_delta related to the difference between the horizontal and vertical coordinate values.

[0137] The entropy decoding unit 105 can determine the horizontal coordinate value Sr_x used to specify the quadrilateral scanning area as information Sr_x related to the horizontal coordinates parsed from the bitstream. The entropy decoding unit 105 can determine the vertical coordinate value Sr_y used to specify the quadrilateral scanning area as the sum of the information Sr_xy_delta parsed from the bitstream and the information Sr_x related to the horizontal coordinates parsed from the bitstream.

[0138] Alternatively, when the value of deltaXYflag is 1, the entropy decoding unit 105 can determine the horizontal coordinate value last_x of the last valid transform coefficient scanned in the TU in the forward scanning order for the specified scan region as information last_x related to the horizontal coordinate value parsed from the bitstream. The entropy decoding unit 105 can determine the vertical coordinate value last_y of the last valid transform coefficient scanned in the TU in the forward scanning order for the specified scan region as the sum of the information last_xy_delta parsed from the bitstream and the information last_x related to the horizontal coordinate value parsed from the bitstream.

[0139] When the value of swap_flag is 1, the entropy decoding unit 105 can swap the coordinates [Sr_x, Sr_y] used to specify the quadrilateral scan region with each other, or can swap the coordinates [last_x, last_y] of the effective transformation coefficients used to specify the scan region in the TU by scanning last in the positive direction scan order.

[0140] The entropy decoding unit 105 can perform context-model-based binary arithmetic decoding on information related to the coordinates of a specified quadrilateral scan region. The entropy decoding unit 105 can obtain debinarization information related to the coordinates of the specified quadrilateral scan region by performing debinarization on the binary arithmetic-decoded information based on a debinarization method corresponding to a predetermined binarization method, and obtain the coordinates of the specified quadrilateral scan region from the debinarization information related to the coordinates. At this time, the context model can be determined based on at least one of the current block size, the current block's color component, and the binindex. The color component can include a luminance component and a chromatic aberration component. The binindex can be information indicating the position of the bin in the current binary arithmetic decoding of the bin string related to the syntax element. The debinarization method corresponding to the predetermined binarization method can be at least one of a fixed-length debinarization method and a truncated unary debinarization method. For example, the entropy decoding unit 105 can obtain first debinarization information by performing debinarization using a fixed-length debinarization method on the first binary string in the information decoded by binary arithmetic, and can obtain second debinarization information by performing debinarization using a truncated unary code debinarization method on the second binary string in the information decoded by binary arithmetic. The entropy decoding unit 105 can obtain the coordinates of a specified quadrilateral scanning region based on the first and second debinarization information.

[0141] The entropy decoding unit 105 can obtain binary arithmetic-decoded information by performing binary arithmetic decoding based on information related to the transform coefficients scanned in the scanned region of the current block. In this case, binary arithmetic decoding can be performed using a context model determined based on at least one of the size and shape of the current block.

[0142] The entropy decoding unit 105 can obtain information related to the transform coefficients of the current block by performing inverse binarization on the information decoded by binary arithmetic.

[0143] The entropy decoding unit 105 can obtain the transform coefficients of the current block by performing at least one of binary arithmetic decoding and debinarization based on a context model related to the transform coefficients scanned in the scanning region.

[0144] When the information related to the transform coefficients is information indicating whether the absolute value of the current transform coefficient is greater than a predetermined value, residual level absolute value information, and sign information of the current transform coefficient, the entropy decoding unit 105 can perform context-model-based binary arithmetic decoding on the scanned information related to the transform coefficients. The entropy decoding unit 105 can obtain the transform coefficients of the current block by performing debinarization on the information related to the transform coefficients after binary arithmetic decoding. When the first information related to the transform coefficients is information indicating whether the absolute value of the current transform coefficient is greater than a predetermined value, residual level absolute value information, and sign information of the current transform coefficient, and the second information related to the transform coefficients is binarization parameter information related to the current transform coefficients, the entropy decoding unit 105 can perform context-model-based binary arithmetic decoding on the first information related to the transform coefficients.

[0145] The entropy decoding unit 105 can perform debinarization on the first information decoded by binary arithmetic based on the binarization parameter information included in the second information to obtain the transform coefficients of the current block. The binarization parameter information can be Rice parameter information related to the transform coefficients. The Rice parameter can be information used to determine the length of the prefix included in the binary string. However, it is not limited to this; the binarization parameter information can be various binarization parameter information related to the current transform coefficients.

[0146] When the first information related to the transform coefficient is the residual level absolute value information of the current transform coefficient, the entropy decoding unit 105 can obtain the value related to the residual level absolute value of the current transform coefficient by using the inverse binarization method corresponding to the (truncated) Rice binarization method and the inverse binarization method corresponding to the exponential Columbus binarization method on the residual level absolute value information of the current transform coefficient. For example, the entropy decoding unit 105 can obtain a first value related to the absolute value of the residual level of the current transform coefficient by performing debinarization on the prefix of the binary string of the residual level absolute value information of the current transform coefficient using a debinarization method corresponding to the Rice parameter-based Rice binarization method, and obtain a second value related to the absolute value of the residual level of the current transform coefficient by performing debinarization on the suffix of the binary string of the residual level absolute value information using a debinarization method corresponding to the exponential Golomb binarization method, and obtain a value related to the absolute value of the residual level of the current block based on the first value and the second value related to the absolute value of the residual level of the current transform coefficient.

[0147] The context model associated with the first transform coefficient in the context model associated with the transform coefficient can be determined by one of the following: information related to at least one second transform coefficient that was previously scanned in a predetermined scanning order, the position and color component of the first transform coefficient in the current block, information related to neighboring transform coefficients located on the right or bottom side, and the scan position of the first transform coefficient.

[0148] For example, a context model related to flag information indicating whether a first transformation coefficient is greater than 0 can be determined based on the number of transformation coefficients located to the right or bottom of a predetermined position whose absolute value is greater than 0.

[0149] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 0 can be determined based on the number of valid transform coefficients whose absolute value is greater than 0 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0150] Alternatively, a context model related to the flag information indicating whether the first transformation coefficient is greater than 0 can be determined based on the position of the first transformation coefficient in the corresponding coefficient group and the flag of the adjacent valid coefficient group located to the right or below.

[0151] The entropy decoding unit 105 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 0 based on the position of the first transform coefficient in the current block. For example, when the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred1, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred2, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred3, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset3 and determine the context model based on the increased context index.

[0152] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 0 based on at least one of the following: the size of the scan region, the number of transform coefficients that have been scanned in the scan region, the relative position of the first transform coefficient in the scan region, and whether the first transform coefficient is the coefficient of the first position scanned in a predetermined scan order.

[0153] For example, the entropy decoding unit 105 can determine the size_sr of the quadrilateral scanning region based on the following equation 4. In other words, the size_sr of the quadrilateral scanning region can represent the number of transform coefficients included in the quadrilateral scanning region.

[0154] Equation 4

[0155]

[0156] However, this is not the only limitation. When the scan area is specified by the coordinates of the last valid transform coefficient pixel, size_sr can be the number of transform coefficient pixels included in that scan area.

[0157] The entropy decoding unit 105 can determine the number of all transform coefficients scanned before the first transform coefficient in the quadrilateral scanning region, cnt_pos. At this time, cnt_pos can indicate the position of the first transform coefficient among all transform coefficients scanned in the scanning region according to a predetermined scanning order.

[0158] When cnt_pos is less than a predetermined threshold thred1, the entropy decoding unit 105 can increment the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. In this case, thred1 can be 1. Alternatively, thred1 can be 1 / 4 × size_sr.

[0159] When cnt_pos is less than a predetermined threshold thred2, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. In this case, thred2 can be 1 / 4 × size_sr. Alternatively, thred2 can be 1 / 2 × size_sr.

[0160] When cnt_pos is not less than predetermined thresholds thred1 and thred2, the entropy decoding unit 105 can add a predetermined context offset 3 to the context index and determine the context model based on the added context index. However, the thresholds thred1 and thred2 are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr.

[0161] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 0 based on the relative position of the first transform coefficient in the scanning area.

[0162] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transformation coefficient is greater than 0 based on the horizontal coordinate value pos_x and the vertical coordinate value pos_y of the first transformation coefficient in the current block, as well as the coordinates Sr_x and Sr_y of the specified quadrilateral scan region.

[0163] When pos_x is less than thred1_x and pos_y is less than thred1_y, the entropy decoding unit 105 can add a predetermined context offset 1 to the context index and determine the context model based on the added context index. In this case, [thred1_x, thred1_y] can be [1, 1]. Alternatively, [thred1_x, thred1_y] can be [sr_x / 4, sr_y / 4] or [(sr_x+1) / 4, (sr_y+1) / 4].

[0164] When pos_x is less than thred2_x and pos_y is less than thred2_y, the entropy decoding unit 105 can add a predetermined context offset 2 to the context index and determine the context model based on the added context index. At this time, [thred2_x,thred2_y] or [thred1_x,thred1_y] can be [sr_x / 2,sr_y / 2] or [(sr_x+1) / 2,(sr_y+1) / 2].

[0165] However, the thresholds thred1_x, thred1_y and thred2_y, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on sr_x and sr_y.

[0166] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 0 based on whether the first transform coefficient is the transform coefficient of the first position scanned in reverse scanning order. In other words, the entropy decoding unit 105 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 0 when the first transform coefficient is the first position scanned in reverse scanning order, and can determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 0 when the first transform coefficient is not the first position scanned in reverse scanning order. In this case, the transform coefficient of the pixel located at the lower right end of the quadrilateral scanning area can be the transform coefficient of the first position scanned in reverse scanning order.

[0167] Alternatively, the flag information indicating whether the first transform coefficient is greater than 0 (GT0 flag information) can be determined based on at least one of the following: the GTO flag information of the n (n is a positive integer) transform coefficients previously scanned according to a predetermined scanning order and the GTO flag information of the position, color component and adjacent right or bottom n (n is a positive integer) transform coefficients of the first transform coefficient in the current block; whether the first transform coefficient is the transform coefficient at the initial position in the scanned area according to the scanning order; and whether the first transform coefficient is the transform coefficient at the final position in the scanned area according to the scanning order.

[0168] The context model associated with the flag information indicating whether the absolute value of the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients to the right or below that have an absolute value greater than 1 among the transform coefficients to the right or below at a predetermined position.

[0169] The entropy decoding unit 105 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 1 based on the position of the first transform coefficient in the current block. For example, when the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred1, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred2, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index.

[0170] When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred3, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset3 and determine the context model based on the increased context index. At this time, the offsets offset1, offset2, and offset3 associated with the context model regarding flag information indicating whether the first transform coefficient is greater than 1, and the predetermined thresholds thred1, thred2, and thred3, can be different from the offsets offset1, offset2, and offset3 associated with the context model regarding flag information indicating whether the first transform coefficient is greater than 0, and the predetermined thresholds thred1, thred2, and thred3.

[0171] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on at least one of the following: the size of the scan region, the number of transform coefficients that have been scanned in the scan region, the relative position of the first transform coefficient in the scan region, and whether the first transform coefficient is the first non-zero transform coefficient scanned in a predetermined scan order.

[0172] For example, the entropy decoding unit 105 can determine the size_sr of the quadrilateral scanning region based on the following equation 5. In other words, the size_sr of the quadrilateral scanning region can represent the number of transform coefficients included in the quadrilateral scanning region.

[0173] Equation 5

[0174]

[0175] The entropy decoding unit 105 can determine the number of all transform coefficients scanned before scanning the first transform coefficient within the quadrilateral scan region, cnt_pos. In this case, cnt_pos can indicate the position of the first transform coefficient among all transform coefficients scanned in a predetermined scan order within the scan region. However, it is not limited to this; cnt_pos can also be the number of all transform coefficients greater than 0 scanned before scanning the first transform coefficient within the quadrilateral scan region.

[0176] When cnt_pos is less than a predetermined threshold thred1, the entropy decoding unit 105 can increment the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. In this case, thred1 can be 1. Alternatively, thred1 can be 1 / 4 × size_sr.

[0177] When cnt_pos is less than a predetermined threshold thred2, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. In this case, thred2 can be 1 / 4 × size_sr. Alternatively, thred2 can be 1 / 2 × size_sr.

[0178] When cnt_pos is not less than the predetermined thresholds thred1 and thred2, the entropy decoding unit 105 can add a predetermined context offset 3 to the context index and determine the context model based on the added context index.

[0179] However, the thresholds thred1 and thred2 are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, offset2, and offset3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 1, and the predetermined thresholds thred1 and thred2, can differ from the offsets offset1, offset2, and offset3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0, and the predetermined thresholds thred1 and thred2.

[0180] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on the relative position of the first transform coefficient in the scanning area.

[0181] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transformation coefficient is greater than 1 based on the horizontal coordinate value pos_x and the vertical coordinate value pos_y of the first transformation coefficient in the current block, as well as the coordinates Sr_x and Sr_y of the specified quadrilateral scan region.

[0182] When pos_x is less than thred1_x and pos_y is less than thred1_y, the video decoding device 100 can increment the context index by a predetermined context offset offset1 and determine the context model based on the incremented context index. In this case, [thred1_x, thred1_y] can be [1, 1]. Alternatively, [thred1_x, thred1_y] can be [sr_x / 4, sr_y / 4] or [(sr_x+1) / 4, (sr_y+1) / 4].

[0183] When pos_x is less than thred2_x and pos_y is less than thred2_y, the entropy decoding unit 105 can add a predetermined context offset 2 to the context index and determine the context model based on the added context index. At this time, [thred2_x,thred2_y] or [thred1_x,thred1_y] can be [sr_x / 2,sr_y / 2] or [(sr_x+1) / 2,(sr_y+1) / 2].

[0184] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on sr_x and sr_y.

[0185] However, the thresholds thred1_x, thred1_y, and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, offset2, and offset3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 1, and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y, can differ from the offsets offset1, offset2, and offset3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0, and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y.

[0186] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on whether the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order. In other words, the video decoding device 100 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order, and determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is not the first position among the transform coefficients greater than 0 scanned in reverse scanning order.

[0187] However, not limited to this, the context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients with an absolute value greater than 1 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0188] Alternatively, a context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 1 can be determined based on the previously decoded GT1 flag information in the corresponding coefficient group and the GT1 flag information in the previously decoded coefficient group.

[0189] Alternatively, the flag information indicating whether the absolute value of the first transform coefficient is greater than 1 (GT1 flag information) can be determined based on at least one of the following: GT1 flag information of the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the GT1 flag information of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the initial position in the scan area, and whether the first transform coefficient is the transform coefficient at the final position in the scan area.

[0190] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients located on the right or bottom side with an absolute value greater than 2.

[0191] The entropy decoding unit 105 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 0 based on the position of the first transform coefficient in the current block. For example, when the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred1, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred2, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred3, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset3 and determine the context model based on the increased context index. At this point, the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 2, and the predetermined thresholds thred1, 2, and 3, may be different from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 and 1, and the predetermined thresholds thred1, 2, and 3.

[0192] The entropy decoding unit 105 can determine the context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on at least one of the following: the size of the scan region, the number of transform coefficients that have been scanned in the scan region, the relative position of the first transform coefficient in the scan region, and whether the first transform coefficient is the first non-zero position (or the first position among transform coefficients greater than 1) scanned in a predetermined scan order.

[0193] For example, the entropy decoding unit 105 can determine the size_sr of the quadrilateral scanning region based on the following equation 6. In other words, size_sr can represent the number of transform coefficients included in the quadrilateral scanning region.

[0194] Equation 6

[0195]

[0196] The entropy decoding unit 105 can determine the number of all transform coefficients scanned before the first transform coefficient is scanned within the quadrilateral scan region, cnt_pos. At this time, cnt_pos can indicate the position of the first transform coefficient among all transform coefficients scanned in the scan region according to a predetermined scan order. However, it is not limited to this; cnt_pos can be the number of all transform coefficients scanned before the first transform coefficient is scanned within the quadrilateral scan region, and whose absolute value is greater than 1.

[0197] When cnt_pos is less than a predetermined threshold thred1, the entropy decoding unit 105 can increment the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. In this case, thred1 can be 1. Alternatively, thred1 can be 1 / 4 × size_sr.

[0198] When cnt_pos is less than a predetermined threshold thred2, the entropy decoding unit 105 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. In this case, thred2 can be 1 / 4 × size_sr. Alternatively, thred2 can be 1 / 2 × size_sr.

[0199] When cnt_pos is not less than the predetermined thresholds thred1 and thred2, the entropy decoding unit 105 can add a predetermined context offset 3 to the context index and determine the context model based on the added context index.

[0200] However, the thresholds thred1 and thred2 are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 or 1, and the predetermined thresholds thred1 and thred2, can differ from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 or 1, and the predetermined thresholds thred1 and thred2.

[0201] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 2 based on the relative position of the first transform coefficient in the scanning area.

[0202] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transformation coefficient is greater than 2 based on the horizontal coordinate value pos_x and the vertical coordinate value pos_y of the first transformation coefficient in the current block, as well as the coordinates Sr_x and Sr_y of the specified quadrilateral scan area.

[0203] When pos_x is less than thred1_x and pos_y is less than thred1_y, the entropy decoding unit 105 can add a predetermined context offset 1 to the context index and determine the context model based on the added context index. In this case, [thred1_x, thred1_y] can be [1, 1]. Alternatively, [thred1_x, thred1_y] can be [sr_x / 4, sr_y / 4] or [(sr_x+1) / 4, (sr_y+1) / 4].

[0204] When pos_x is less than thred2_x and pos_y is less than thred2_y, the entropy decoding unit 105 can add a predetermined context offset offset2 to the context index and determine the context model based on the added context index. At this time, [thred2_x, thred2_y] or [thred1_x, thred1_y] can be [sr_x / 2, sr_y / 2] or [(sr_x+1) / 2, (sr_y+1) / 2].

[0205] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on sr_x and sr_y.

[0206] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 or 1, and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y, can differ from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y.

[0207] The entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 2 based on whether the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order. In other words, the entropy decoding unit 105 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order, and determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is not the first position among the transform coefficients greater than 0 scanned in reverse scanning order.

[0208] However, not limited to this, the entropy decoding unit 105 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 2 based on whether the first transform coefficient is the first position among transform coefficients greater than 1 scanned in reverse scanning order. In other words, the entropy decoding unit 105 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is the first position among transform coefficients greater than 1 scanned in reverse scanning order, and determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 2 when the first transform coefficient is not the first position among transform coefficients greater than 1 scanned in reverse scanning order.

[0209] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients with an absolute value greater than 2 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0210] Alternatively, a context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 2 can be determined based on the previously decoded GT2 flag information in the corresponding coefficient group and the GT2 flag information in the previously decoded coefficient group.

[0211] Alternatively, the flag information indicating whether the absolute value of the first transform coefficient is greater than 2 (hereinafter referred to as GT2 flag information) can be determined based on at least one of the following: GT2 flag information of the n (n is a positive integer) transform coefficients previously scanned according to a predetermined scanning order and GT2 flag information of the position, color component and adjacent right or bottom n (n is a positive integer) transform coefficients of the first transform coefficient in the current block, whether the first transform coefficient is the transform coefficient at the initial position in the scan area and whether the first transform coefficient is the transform coefficient at the final position in the scan area.

[0212] Alternatively, the flag information indicating whether the absolute value of the first transform coefficient is greater than m (where m is an integer greater than 2) (hereinafter referred to as GTm flag information) can be determined based on at least one of the following: GTm flag information of the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order and GTm flag information of the position, color component, and adjacent right or bottom n (n is a positive integer) transform coefficients of the first transform coefficient in the current block; whether the first transform coefficient is the transform coefficient at the first position in the scanned area; and whether the first transform coefficient is the transform coefficient at the final position in the scanned area.

[0213] In addition, binarization parameter information related to the residual level absolute value of the first transform coefficient can be determined based on the level absolute value of the neighboring effective transform coefficients to the right or below the first transform coefficient.

[0214] For example, binarization parameter information related to the residual level absolute value of the first transform coefficient can be determined based on the sum of the level absolute values ​​of the predetermined surrounding valid transform coefficients to the right or below the first transform coefficient.

[0215] Alternatively, the binarization parameter information related to the residual level absolute value of the first transform coefficients can be determined based on the previously encoded level value.

[0216] Alternatively, the binarization parameter information related to the absolute value of the remaining level of the first transform coefficient can be determined based on at least one of the following: the levels of the n (n is an integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the levels of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the initial position in the scanned area in the scanning order, whether the first transform coefficient is the transform coefficient at the final position in the scanned area in the scanning order, and whether the first transform coefficient is the coefficient at the initial position in the coefficient group in the scanning order.

[0217] When the position of the currently scanned transform coefficient in the scanning region is [SRx, 0] (SRx is an integer, SRx indicates the horizontal coordinate value of the pixel on the right boundary of the scanning region with reference to the coordinates of the upper left corner of the scanning region), and all the transform coefficients located at the previously scanned position [SRx, Y] (Y is an integer greater than 0 and less than or equal to SRy, SRy refers to the vertical coordinate value of the pixel on the lower boundary of the scanning region with reference to the coordinates of the upper left corner of the scanning region) are 0, the entropy decoding unit 105 can determine the value of the GTO flag information as 1 without obtaining the GTO flag information of the currently scanned transform coefficient from the bit stream.

[0218] Similarly, when the position of the currently scanned transform coefficient in the scanning region is [0, SRy] (SRy is an integer, SRy indicates the vertical coordinate value of the lower boundary pixel of the scanning region with the coordinates of the upper left corner of the scanning region as the reference), and all the transform coefficients located at the previously scanned position [X, SRy] (X is an integer greater than 0 and less than or equal to SRx, SRx indicates the vertical coordinate value of the right boundary pixel of the scanning region with the coordinates of the upper left corner of the scanning region as the reference) are 0, the entropy decoding unit 105 can determine the value of the GTO flag information as 1 without obtaining the GTO flag information of the currently scanned transform coefficient from the bit stream.

[0219] Furthermore, the entropy decoding unit 105 can determine the maximum number of GT1 flag information for valid transform coefficients in the current block, and receive GT1 flag information for the current block from the bitstream within the determined maximum coefficient range of valid transform coefficients. In other words, when the entropy decoding unit 105 receives the maximum number of GT1 flag information for valid transform coefficients from the bitstream, the entropy decoding unit 105 may not subsequently confirm the existence of GT1 flag information for valid transform coefficients in the bitstream.

[0220] The entropy decoding unit 105 can determine the maximum number of GT1 flags in the current block by identifying all valid transform coefficients that are not zero. Alternatively, the entropy decoding unit 105 can determine the maximum number of GT1 flags in the current block based on the size of the scanned region. For example, the entropy decoding unit 105 can determine the maximum number of GT1 flags, MaxCount_GT1, based on the following equation 7.

[0221] Equation 7

[0222]

[0223] At this point, `sizeSR` can represent the size (area) of the quadrilateral scanning region, and `sizeSR` can be (Sr_x+1)×(Sr_y+1). `Sr_x` can represent the horizontal coordinate of the rightmost effective transform coefficient pixel, based on the coordinates of the top left corner of the scanning region. In other words, `Sr_x` can represent the horizontal coordinate of the rightmost boundary pixel, based on the coordinates of the top left corner of the scanning region. `Sr_y` can represent the vertical coordinate of the bottommost effective transform coefficient pixel, based on the coordinates of the top left corner of the scanning region. In other words, `Sr_y` can represent the vertical coordinate of the bottommost boundary pixel, based on the coordinates of the top left corner of the scanning region.

[0224] K1 can be an adjustment factor between the size of the scan area and the GT1 flag. For example, it can be an integer greater than 1. Th1 can be a predetermined threshold. For example, Th1 can be 16 or 8. However, it is not limited thereto, and those skilled in the art will readily understand that K1 and Th1 can have various values.

[0225] The entropy decoding unit 105 can determine the maximum number of GT2 flag information in the current block, and receive the GT2 flag information in the current block from the bitstream within the determined maximum coefficient of valid transform coefficients. In other words, when the entropy decoding unit 105 receives the maximum number of GT2 flag information of valid transform coefficients from the bitstream, the entropy decoding unit 105 may not need to confirm the existence of GT2 flag information of valid transform coefficients in the bitstream thereafter.

[0226] The entropy decoding unit 105 can determine the maximum number of GT2 flags in the current block by identifying all valid transform coefficients that are not zero. Alternatively, the entropy decoding unit 105 can determine the maximum number of GT2 flags in the current block based on the size of the scanned region. For example, the entropy decoding unit 105 can determine the maximum number of GT2 flags, MaxCount_GT2, based on the following equation 8.

[0227] [Equation 8]

[0228]

[0229] At this point, sizeSR can represent the size (area) of the quadrilateral scanning region, and sizeSR can be (Sr_x+1)×(Sr_y+1). Sr_x can represent the horizontal coordinate of the rightmost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_x can represent the horizontal coordinate of the rightmost boundary pixel based on the coordinates of the upper left corner of the scanning region. Sr_y can represent the vertical coordinate of the lowermost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_y can represent the vertical coordinate of the lower boundary pixel based on the coordinates of the upper left corner of the scanning region. K2 can be an adjustment coefficient between the size of the scanning region and the GT1 flag. For example, it can be an integer greater than 1. Th2 can be a predetermined threshold. For example, Th2 can be 16 or 8. However, it is not limited to this, and those skilled in the art will readily understand that K2 and Th2 can have various values.

[0230] The entropy decoding unit 105 can obtain information related to the coefficient group in the current block from the bitstream. Here, the information related to the coefficient group can be flag information indicating whether the coefficient group includes at least one valid transform coefficient (or whether the coefficient group includes only transform coefficients that are 0). This flag information can be referred to as a significant coefficient group flag. The entropy decoding unit 105 can scan information related to the transform coefficients in the current coefficient group based on the information related to the current coefficient group obtained from the bitstream. For example, when the information related to the coefficient group indicates that at least one valid transform coefficient is not included in the coefficient group, the entropy decoding unit 105 can derive the value of the transform coefficient in the coefficient group as 0 without scanning the information related to the transform coefficient. When the information related to the coefficient group indicates that at least one valid transform coefficient is included in the coefficient group, the entropy decoding unit 105 can scan the information related to the transform coefficient in a predetermined scanning order to obtain the transform coefficients in the coefficient group.

[0231] At this time, for the transform coefficients included in the scanning region, the entropy decoding unit 105 of the entropy decoding section can determine a coefficient group based on each predetermined K (K is an integer) transform coefficients scanned according to a predetermined scanning order. That is, a coefficient group can include K transform coefficients. At this time, the scanning order can be a forward scanning order that is opposite to the predetermined reverse scanning order.

[0232] Therefore, the entropy decoding unit 105 can determine the coefficient group by scanning the DC coefficients, which are adjacent to the upper left corner of the current block, in a forward scanning order. At this time, when the number of transform coefficients included in the current block is not an integer multiple of K, the final coefficient group in the coefficient group scanned in a forward scanning order may include a number of transform coefficients less than K.

[0233] However, not limited thereto, those skilled in the art will readily understand that the entropy decoding unit 105 can determine the coefficient group by scanning in the reverse direction from the coefficients located at the lower right end of the transform coefficients included in the current block to the coefficients located at the upper left end of the transform coefficients included in the current block.

[0234] However, not limited thereto, those skilled in the art will readily understand that the entropy decoding unit 105 may not obtain information related to the coefficient groups in the current block from the bitstream, and may determine the coefficient groups according to a predetermined scanning order. The reason for determining the coefficient groups is that the entropy decoding unit 105 performs operations based on the coefficient groups (e.g., operations such as sign data hiding). When a coefficient group in the coefficient groups scanned according to the predetermined scanning order contains only one transform coefficient, the entropy decoding unit 105 may obtain GTO flag information from the bitstream instead of information related to the corresponding coefficient group.

[0235] The entropy decoding unit 105 can determine whether to hide the sign of at least one transform coefficient for each coefficient group included in the current block. For example, the entropy decoding unit can determine, depending on the situation, to hide the sign of one or two transform coefficients for each coefficient group included in the current block.

[0236] The entropy decoding unit 105 can scan information related to the transform coefficients in the quadrilateral scanning region according to a predetermined scanning order. The predetermined scanning order may include a reverse zigzag scanning order, a reverse diagonal scanning order, and a reverse vertical and horizontal scanning order. However, those skilled in the art will readily understand that the predetermined scanning order is not limited to the aforementioned reverse scanning order, but includes various reverse scanning orders.

[0237] The entropy decoding unit 105 can obtain the transform coefficients of the current block based on the scanned information related to the transform coefficients.

[0238] The image restoration unit 120 can generate the residual block of the current block by performing inverse quantization and inverse transformation on the transform coefficients of the current block.

[0239] The image restoration unit 120 can restore the current block based on the residual block of the current block.

[0240] Image restoration unit 120 can perform inter-frame prediction or intra-frame prediction for the current block to generate a prediction block for the current block. Image restoration unit 120 can restore the current block based on the prediction block and the residual block of the current block. In other words, image restoration unit 120 restores the values ​​of pixels included in the current block by adding the values ​​of pixels included in the prediction block to the values ​​of pixels included in the residual block.

[0241] The entropy decoding unit 105 can perform context-model-based binary arithmetic decoding on information related to the coordinates of a specified quadrilateral scan region. The entropy decoding unit 105 can obtain debinarization information related to the coordinates of the specified quadrilateral scan region by performing debinarization using a predetermined debinarization method on the binary-arithmically decoded information, and obtain the coordinates of the specified quadrilateral scan region based on the debinarization information related to the coordinates. At this time, the context model can be determined based on at least one of the current block size and the current block's color components and binarization index. The color components may include luminance components and chrominance components. The binarization index may be information indicating the position of the current binary (bin) in the binary string related to the syntax element, representing the current binary (bin) of the binary arithmetic decoding. Here, the predetermined debinarization method can be at least one of fixed-length debinarization and truncated unary code debinarization methods.

[0242] The entropy decoding unit 105 can obtain the transform coefficients of the current block by performing at least one of binary arithmetic decoding and debinarization based on a context model related to the effective transform coefficients, based on information related to the scanned effective transform coefficients. When the information related to the effective transform coefficients is information indicating whether the absolute value of the current effective transform coefficient is greater than a predetermined value, residual level information, and sign information of the current effective transform coefficient, the entropy decoding unit 105 can perform context model-based binary arithmetic decoding on the scanned information related to the effective transform coefficients. The entropy decoding unit 105 can obtain the transform coefficients of the current block by performing debinarization on the binary arithmetic-decoded information related to the effective transform coefficients. When the first information related to the effective transform coefficients is information indicating whether the absolute value of the current effective transform coefficient is greater than a predetermined value, residual level information, and sign information of the current effective transform coefficient, and the second information related to the effective transform coefficients is binarization parameter information, the entropy decoding unit 105 can perform context model-based binary arithmetic decoding on the first information related to the effective transform coefficients. The entropy decoding unit 105 can perform debinarization on the first information decoded by binary arithmetic based on binarization parameter information including the second information to obtain the transform coefficients of the current block. The binarization parameter information may be Rice parameter information related to the transform coefficients. The context model related to the first transform coefficient in the context model related to the flag information of the transform coefficients can be determined based on at least one of the following: information related to at least one second transform coefficient previously scanned according to a predetermined scanning order, the position and color component of the first transform coefficient in the current block, information related to the surrounding transform coefficients on the right or bottom side, and the scanning position of the first transform coefficient.

[0243] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 0 can be determined based on the number of valid transform coefficients located on the right or bottom side with an absolute value greater than 0.

[0244] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 0 can be determined based on the number of valid transform coefficients with an absolute value greater than 0 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0245] Alternatively, the flag information indicating whether the first transform coefficient is greater than 0 (hereinafter referred to as the GTO flag information) can be determined based on at least one of the following: the GTO flag information of the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the GTO flag information of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the first position in the scanned area, and whether the first transform coefficient is the transform coefficient at the final position in the scanned area.

[0246] The context model associated with the flag information indicating whether the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients on the right and bottom sides whose absolute values ​​are greater than 1.

[0247] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients with an absolute value greater than 1 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0248] Alternatively, the flag information indicating whether the first transform coefficient is greater than 1 (hereinafter referred to as GT1 flag information) can be determined based on at least one of the following: GT1 flag information of the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the GT1 flag information of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the first position in the scan area, and whether the first transform coefficient is the transform coefficient at the final position in the scan area.

[0249] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients to the right or below that have an absolute value greater than 2. However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 2 can also be determined based on the number of valid transform coefficients with an absolute value greater than 2 among the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order.

[0250] Alternatively, the flag information indicating whether the first transform coefficient is greater than 2 (hereinafter referred to as GT2 flag information) can be determined based on at least one of the following: GT1 flag information of the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the GT1 flag information of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the first position in the scan area, and whether the first transform coefficient is the transform coefficient at the final position in the scan area.

[0251] Alternatively, the flag information indicating whether the absolute value of the first transform coefficient is greater than m (where m is an integer greater than 2) (hereinafter referred to as GTm flag information) can be determined based on at least one of the following: GTm flag information of the n (n is a positive integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the GTm flag information of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the first position in the scanned area, and whether the first transform coefficient is the transform coefficient at the final position in the scanned area.

[0252] Additionally, binarization parameter information related to the residual level absolute value of the first transform coefficient can be determined based on the level absolute values ​​of the neighboring effective transform coefficients to the right and below the first transform coefficient.

[0253] For example, binarization parameter information related to the remaining level absolute values ​​of the first transform coefficient can be determined based on the sum of the level absolute values ​​of adjacent effective transform coefficients located to the right or below the first transform coefficient.

[0254] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients with an absolute value greater than 2 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0255] The context model associated with the flag information indicating whether the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients on the right and bottom sides whose absolute values ​​are greater than 1.

[0256] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients to the right or below where the absolute value is greater than 2.

[0257] Furthermore, binarization parameter information related to the residual level absolute value of the first transform coefficient can be determined based on the level absolute values ​​of the neighboring effective transform coefficients to the right and below the first transform coefficient. For example, binarization parameter information related to the residual level absolute value of the first transform coefficient can be determined based on the sum of the level absolute values ​​of the neighboring effective transform coefficients to the right and below the first transform coefficient.

[0258] The binarization parameter information related to the absolute value of the remaining level of the first transform coefficient can be determined based on at least one of the following: the levels of the n (n is an integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the levels of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the first transform coefficient in the scanned region in the scanning order, whether the first transform coefficient is the last transform coefficient in the scanned region in the scanning order, and whether the first transform coefficient is the first coefficient in the coefficient group in the scanning order.

[0259] When the position of the currently scanned transform coefficient in the scanning region is [SRx, 0] (SRx is an integer, SRx indicates the horizontal coordinate value of the right boundary pixel of the scanning region based on the coordinates of the upper left corner of the scanning region), and the transform coefficients of the previously scanned position [SRx, Y] (Y is an integer greater than 0 and less than or equal to SRy, SRy indicates the vertical coordinate value of the lower boundary pixel of the scanning region based on the coordinates of the upper left corner of the scanning region) are all 0 according to the predetermined scanning order, the entropy decoding unit 105 can determine the value of the GTO flag information as 1 without obtaining the GTO flag information of the currently scanned transform coefficient from the bit stream.

[0260] Similarly, when the position of the currently scanned transform coefficient in the scanning region is [0, SRy] (SRy is an integer, SRy indicates the vertical coordinate value of the lower boundary pixel of the scanning region based on the coordinates of the upper left corner of the scanning region), and the transform coefficients of the previously scanned positions [X, SRy] (X is an integer greater than 0 and less than or equal to SRx, SRx indicates the vertical coordinate value of the right boundary pixel of the scanning region based on the coordinates of the upper left corner of the scanning region) are all 0 according to the predetermined scanning order, the entropy decoding unit 105 can determine the value of the GTO flag information as 1 without obtaining the GTO flag information of the currently scanned transform coefficient from the bit stream.

[0261] Furthermore, the entropy decoding unit 105 can determine the maximum number of GT1 flag information for valid transform coefficients in the current block, and receive GT1 flag information for the current block from the bitstream within the determined maximum coefficient range of valid transform coefficients. In other words, when the entropy decoding unit 105 receives the maximum number of GT1 flag information for valid transform coefficients from the bitstream, the entropy decoding unit 105 may not subsequently confirm whether there is any GT1 flag information for valid transform coefficients in the bitstream.

[0262] The entropy decoding unit 105 can determine the maximum number of GT1 flags in the current block by identifying all valid transform coefficients that are not zero. Alternatively, the entropy decoding unit 105 can determine the maximum number of GT1 flags in the current block based on the size of the scanned region. For example, the entropy decoding unit 105 can determine the maximum number of GT1 flags, MaxCount_GT1, based on the following equation 9.

[0263] Equation 9

[0264]

[0265] At this point, sizeSR can represent the size (area) of the quadrilateral scanning region, and sizeSR can be (Sr_x+1)×(Sr_y+1). Sr_x can represent the horizontal coordinate of the rightmost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_x can represent the horizontal coordinate of the rightmost boundary pixel based on the coordinates of the upper left corner of the scanning region. Sr_y can represent the vertical coordinate of the lowermost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_y can represent the vertical coordinate of the lower boundary pixel based on the coordinates of the upper left corner of the scanning region. K1 can be an adjustment coefficient between the size of the scanning region and the GT1 flag. For example, it can be an integer greater than 1. Th1 can be a predetermined threshold. For example, Th1 can be 16 or 8. However, it is not limited to this. Those skilled in the art will readily understand that K1 and Th1 can have various values.

[0266] The entropy decoding unit 105 can determine the maximum number of GT2 flag information in the current block, and receive the GT2 flag information in the current block from the bitstream within the determined maximum coefficient of valid transform coefficients. In other words, when the entropy decoding unit 105 receives the maximum number of GT2 flag information of valid transform coefficients from the bitstream, the entropy decoding unit 105 may not need to confirm the existence of GT2 flag information of valid transform coefficients in the bitstream thereafter.

[0267] The entropy decoding unit 105 can determine the maximum number of GT2 flags in the current block by identifying all valid transform coefficients that are not zero. Alternatively, the entropy decoding unit 105 can determine the maximum number of GT2 flags in the current block based on the size of the scanned region. For example, the entropy decoding unit 105 can determine the maximum number of GT2 flags, MaxCount_GT2, based on the following equation 10.

[0268] Equation 10

[0269]

[0270] At this point, sizeSR can represent the size (area) of the quadrilateral scanning region, and sizeSR can be (Sr_x+1)×(Sr_y+1). Sr_x can represent the horizontal coordinate of the rightmost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_x can represent the horizontal coordinate of the rightmost boundary pixel based on the coordinates of the upper left corner of the scanning region. Sr_y can represent the vertical coordinate of the lowermost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_y can represent the vertical coordinate of the lower boundary pixel based on the coordinates of the upper left corner of the scanning region. K2 can be an adjustment coefficient. For example, K2 can be an integer greater than 1. Th2 can be a predetermined threshold. For example, Th2 can be 16 or 8. However, it is not limited to this, and those skilled in the art will readily understand that K2 and Th2 can have various values.

[0271] The entropy decoding unit 105 can obtain information related to coefficient groups in the current block from the bitstream. This information may include flag information indicating whether the coefficient group includes at least one valid transform coefficient. In this case, for transform coefficients included in the scanning region, the entropy decoding unit 105 can determine a coefficient group based on each predetermined K (K is an integer) transform coefficients scanned according to a predetermined scanning order. That is, a coefficient group may include K transform coefficients. The scanning order may be a forward scanning order that is the opposite of a predetermined reverse scanning order. Here, the predetermined reverse scanning order may represent the order of scanning from the lower right coefficient in the current block to the upper left coefficient in the current block.

[0272] Therefore, the entropy decoding unit 105 can determine the coefficient group by scanning the DC coefficients, which are adjacent to the upper left corner of the current block, in a forward scanning order. At this time, when the number of transform coefficients included in the current block is not an integer multiple of K, the final coefficient group in the group of coefficients scanned in the forward scanning order may include transform coefficients with a number less than K. However, it is not limited to this; those skilled in the art will readily understand that the entropy decoding unit 105 can determine the coefficient group by scanning in a reverse scanning order, from the lower right corner coefficients included in the current block to the upper left corner coefficients included in the current block.

[0273] When the final coefficient group in the coefficient group scanned in a predetermined scanning order contains only one transform coefficient, the entropy decoding unit 105 may obtain only the GTO flag information from the bit stream instead of obtaining information related to the coefficient group from the bit stream.

[0274] The entropy decoding unit 105 can determine whether to hide the sign of at least one transform coefficient for each coefficient group included in the current block. For example, the entropy decoding unit can determine, depending on the situation, to hide the sign of one or two transform coefficients for each coefficient group included in the current block.

[0275] The entropy decoding unit 105 can scan information related to the effective transform coefficients in the quadrilateral scanning region according to a predetermined scanning order. The predetermined scanning order may include a reverse zigzag scanning order, a reverse diagonal scanning order, and a reverse vertical and horizontal scanning order. However, those skilled in the art will readily understand that the predetermined scanning order is not limited to the aforementioned reverse scanning order, but includes various reverse scanning orders.

[0276] The entropy decoding unit 105 can obtain the transform coefficients of the current block based on the scanned information related to the transform coefficients.

[0277] The image restoration unit 120 can generate the residual block of the current block by performing inverse quantization and inverse transformation on the transform coefficients of the current block.

[0278] The image restoration unit 120 can restore the current block based on the residual block of the current block.

[0279] Image restoration unit 120 can perform inter-frame prediction or intra-frame prediction on the current block to generate a prediction block for the current block. Image restoration unit 120 can restore the current block based on the prediction block and the residual block of the current block. In other words, image restoration unit 120 restores the values ​​of pixels included in the current block by adding the values ​​of pixels included in the prediction block to the values ​​of pixels included in the residual block. This will be discussed later in the section on... Figure 3a The description describes optical flow.

[0280] The video decoding device 100 may include an image decoding unit (not shown), and the image decoding unit (not shown) may include an entropy decoding unit 105 and an image restoration unit 120. (Refer to...) Figure 1e Describe the image decoding unit. Figure 1b A flowchart of a video decoding method according to various embodiments is shown.

[0281] In step S105, the video decoding apparatus 100 can determine a scanning region that includes all valid transform coefficients in the current block. At this time, when scanning is performed from the upper left end of the scanning region in a predetermined forward scanning order, the scanning region can be a region including transform coefficients up to the last scanned valid transform coefficient (hereinafter referred to as the last valid transform coefficient). At this time, the coordinates specifying the scanning region can be the coordinates of the last scanned valid transform coefficient pixel. The video decoding apparatus 100 can obtain information related to the coordinates indicating the last valid transform coefficient from the bitstream and can determine the scanning region based on the obtained information related to the coordinates indicating the last valid transform coefficient.

[0282] Alternatively, the scanning area can be a quadrilateral scanning area, which can be defined by the horizontal coordinates of the rightmost valid transform coefficient pixel in the current block and the vertical coordinates of the bottommost valid transform coefficient pixel in the current block. The video decoding device 100 can obtain information related to the coordinates of the specified quadrilateral scanning area from the bitstream and determine the quadrilateral scanning area based on the obtained information related to the coordinates of the specified quadrilateral scanning area.

[0283] In step S110, the video decoding device 100 can scan information related to the transform coefficients in the scanned area according to a predetermined scanning order. The predetermined scanning order can be a reverse zigzag scanning order or a reverse diagonal scanning order. The zigzag scanning order can include a vertical-priority zigzag scanning order or a horizontal-priority zigzag scanning order. In step S115, the video decoding device 100 can generate binary arithmetic-decoded information by performing binary arithmetic decoding based on the scanned information related to the transform coefficients. At this time, the video decoding device 100 can perform binary arithmetic decoding using a context model determined based on at least one of the size and shape of the current block.

[0284] In step S120, the video decoding device 100 can scan information related to the transform coefficients included in the scanning area according to a predetermined scanning order, and perform inverse binarization on the information decoded by binary arithmetic to obtain information related to the transform coefficients of the current block.

[0285] In step S125, the video decoding apparatus 100 generates a residual block of the current block by performing inverse quantization and inverse transform based on information related to the transform coefficients of the current block. In other words, the video decoding apparatus 100 can obtain the transform coefficients of the current block based on information related to the transform coefficients of the current block, and perform inverse quantization and inverse transform on the transform coefficients of the current block to generate a residual block of the current block.

[0286] In step S130, the video decoding device 100 can recover the current block based on the residual block. The video decoding device 100 can generate a prediction block of the current block by performing inter-frame prediction or intra-frame prediction, and the video decoding device 100 can generate the pixel values ​​of the recovered block of the current block by adding the pixel values ​​included in the prediction block of the current block and the pixel values ​​of the residual block.

[0287] Figure 1c A block diagram of a video encoding apparatus 150 according to various embodiments is shown.

[0288] According to various embodiments, the video encoding apparatus 150 includes an entropy encoding unit 155 and a bitstream generation unit 170.

[0289] The entropy coding unit 155 can perform entropy coding on syntax elements related to the transform coefficients in the current block. The entropy coding unit 155 can generate one-dimensional arrangement information related to the transform coefficients in the current block by scanning the two-dimensional arrangement information related to the transform coefficients in the current block according to a predetermined scanning order, and perform entropy coding on the one-dimensional arrangement information related to the transform coefficients in the current block.

[0290] Syntax elements related to the transform coefficients can be flags indicating whether the transform coefficients are greater than a predetermined value. In this case, the predetermined value can be a value greater than or equal to 0. For example, it can be 0, 1, or 2. Additionally, it can be a syntax element indicating the absolute value of the remaining level related to the transform coefficients. In other words, the absolute value of the remaining level can indicate the difference between the absolute value of the transform coefficient and a predetermined absolute value determined based on whether it is greater than the predetermined value. Furthermore, syntax elements related to the valid transform coefficients can be syntax elements related to the sign of the valid transform coefficients.

[0291] First, the entropy encoding unit 155 can generate a binary string by performing binarization on the syntax elements, and then perform binary arithmetic encoding on the binary string to generate entropy-encoded information for the syntax elements. At this time, binarization can be performed by the binarization unit 160, and binary arithmetic encoding can be performed by the binary arithmetic encoding unit 165.

[0292] Binarization unit 160 can perform binarization on a predetermined syntax element to generate a binary string. Binarization unit 160 can perform binarization on the predetermined syntax element based on a predetermined binarization method. The predetermined binarization method may include a fixed-length binarization method, a Rice binarization method, an Exponential Golomb binarization method, and a Golomb-Rice binarization method. Alternatively, the predetermined binarization method may be a combination of a first binarization method and a second binarization method. For example, binarization unit 160 can perform binarization on a portion of the syntax element based on a first binarization method to generate a first binary string, and perform binarization on another portion of the syntax element based on a second binarization method to generate a second binary string. In this case, the first binary string may be a portion of the binary string of the syntax element, and the second binary string may be another portion of the binary string of the syntax element. A part of a binary string can be a prefix or a suffix.

[0293] Binary arithmetic encoding unit 165 can perform binary arithmetic encoding based on a predetermined context model on a binary string associated with a predetermined syntax element. Alternatively, binary arithmetic encoding unit 165 can perform binary arithmetic encoding on a binary string associated with a predetermined syntax element without a predetermined context model. In this case, the probability of 0 or 1 appearing for the currently binary-encoded binary (bin) is fixed at 0.5, and binary arithmetic encoding is performed based on this probability.

[0294] The entropy coding unit 155 can obtain the transform coefficients of the current block. In other words, the video coding apparatus 150 can generate a prediction block for the current block by performing inter-frame prediction or intra-frame prediction, and generate a residual block for the current block based on the original block and the prediction block. The video coding apparatus 150 can generate the transform coefficients of the current block by performing transform and quantization on the residual block. The entropy coding unit 155 can obtain the transformed coefficients of the generated current block.

[0295] Entropy encoding unit 155 can determine information related to the transform coefficients of the current block, generate one-dimensional arrangement information related to the transform coefficients of the current block by scanning the information related to the transform coefficients of the current block according to a predetermined scanning order, and perform entropy encoding on the one-dimensional arrangement information. The predetermined scanning order can be a zigzag scanning order or a diagonal scanning order. However, it is not limited to this and can be various scanning orders, such as a horizontal scanning order or a vertical scanning order. The predetermined scanning order can be determined based on at least one of the horizontal coordinate of the rightmost valid transform coefficient pixel in the current block and the vertical coordinate of the bottommost valid transform coefficient pixel in the current block. Entropy encoding unit 155 can determine the predetermined scanning order based on the magnitude of the horizontal coordinate value and the magnitude of the vertical coordinate value. For example, when the horizontal coordinate value is greater than the vertical coordinate value, entropy encoding unit 155 can determine the vertical scanning order in the reverse direction as the predetermined scanning order. When the vertical coordinate value is greater than the horizontal coordinate value, entropy encoding unit 155 can determine the horizontal scanning order in the reverse direction as the predetermined scanning order.

[0296] Alternatively, when the horizontal coordinate value is greater than the vertical coordinate value, the entropy encoding unit 155 can determine the reverse vertical-priority zigzag scanning order as the predetermined scanning order. When the vertical coordinate value is greater than the horizontal coordinate value, the entropy encoding unit 155 can determine the reverse horizontal-priority zigzag scanning order as the predetermined scanning order. When the vertical coordinate value is equal to the horizontal coordinate value, the entropy encoding unit 155 can determine either the reverse vertical-priority zigzag scanning order or the horizontal-priority zigzag scanning order as the predetermined scanning order.

[0297] Alternatively, when the horizontal coordinate value is greater than the vertical coordinate value, the entropy encoding unit 155 can determine the horizontal-first zigzag scan order in the reverse direction as the predetermined scan order. When the horizontal coordinate value is not greater than the vertical coordinate value, the entropy encoding unit 155 can determine the horizontal-first zigzag scan order in the reverse direction as the predetermined scan order.

[0298] First, the entropy coding unit 155 can determine a scan region that includes all valid transform coefficients in the current block. At this time, the scan region can include all valid transform coefficients in the current block, and the remaining regions in the current block besides the scan region can only include transform coefficients that are not valid transform coefficients and have a value of 0. When the transform coefficients are scanned from the upper left end of the scan region in a predetermined forward scanning order, the scan region can be a region that includes transform coefficients up to the last scanned valid transform coefficient (hereinafter referred to as the last valid transform coefficient). The coordinates of the specified scan region can be the coordinates of the last scanned valid transform coefficient pixel.

[0299] The entropy encoding unit 155 can generate information related to the coordinates indicating the last valid transform coefficient. For example, the entropy decoding unit 105 can generate syntax element information indicating the horizontal coordinate value of the last valid transform coefficient and syntax element information indicating the vertical coordinate value of the last valid transform coefficient. At this time, the entropy encoding unit 155 can generate a binary string by binarizing the syntax elements indicating the horizontal coordinate value of the last valid transform coefficient and the syntax element information indicating the vertical coordinate value of the last valid transform coefficient, and perform binary arithmetic decoding on the binary string to generate syntax element information indicating the horizontal coordinate value of the last valid transform coefficient and syntax element information indicating the vertical coordinate value of the last valid transform coefficient.

[0300] Entropy coding unit 155 can generate a first binary string by performing a first binarization method on a first value that is part of the syntax element value, and generate a second binary string by performing a second binarization method on a second value that is another part of the syntax element value. A binary string including both the first and second binary strings can be generated. In this case, the first binary string can be a prefix, and the first binarization method can be a fixed-length binarization method. The second binary string can be a suffix, and the second inverse binarization method can be a truncated unary code binarization method.

[0301] Alternatively, the entropy coding unit 155 may generate information indicating the coordinate value of one of the horizontal or vertical directions of the last valid transform coefficient pixel among all valid transform coefficients in the current block, and information indicating the difference between the coordinate value in one direction and the coordinate values ​​in the other directions.

[0302] Alternatively, the scan area can be a quadrilateral scan area, which can be a region specified by the horizontal coordinates of the rightmost valid transform coefficient pixel in the current block and the vertical coordinates of the bottommost valid transform coefficient pixel in the current block.

[0303] The entropy coding unit 155 can generate syntax element information related to the coordinates of the specified quadrilateral scan region. For example, the entropy coding unit 155 can generate syntax element information indicating the horizontal coordinate value of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block and syntax element information indicating the vertical coordinate value of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block. At this time, the entropy coding unit 155 can generate a binary string by performing binarization on the syntax element indicating the horizontal coordinate value of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block and the syntax element indicating the vertical coordinate value of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block, and perform binary arithmetic encoding on the binary string to generate syntax element information indicating the horizontal coordinate value of the last valid transform coefficient and syntax element information indicating the vertical coordinate value of the last valid transform coefficient.

[0304] Entropy coding unit 155 can generate a first binary string by performing a first binarization method on a first value that is part of the syntax element value, and generate a second binary string by performing a second binarization method on a second value that is another part of the syntax element value. A binary string including both the first and second binary strings can be generated. In this case, the first binary string can be a prefix, and the first binarization method can be a fixed-length binarization method. The second binary string can be a suffix, and the second inverse binarization method can be a truncated unary code binarization method.

[0305] Alternatively, the entropy coding unit 155 can generate information indicating the coordinate value in one of the following directions: the horizontal coordinate value of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block, and the vertical coordinate value of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block. Information also indicates the difference between the coordinate value in said direction and the coordinate values ​​in the remaining directions. The entropy coding unit 155 can determine said direction based on the height and width of the current block.

[0306] The entropy coding unit 155 can generate flag information indicating whether information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in the other directions has been obtained.

[0307] Additionally, the entropy coding unit 155 can determine whether to generate flag information based on the width and height of the current block. This flag information indicates whether information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in the other directions has been obtained. For example, when the width and height of the current block are different (i.e., in the case of a rectangle), the entropy coding unit 155 can determine and generate flag information indicating whether information indicating the difference between coordinate values ​​in one direction and coordinate values ​​in the other directions has been obtained.

[0308] The entropy coding unit 155 can determine the context model used for binary arithmetic encoding of all syntax elements for coefficient encoding based on at least one of the current block's size and shape. For example, the size of the current block can be determined based on at least one of the minimum and maximum values ​​of the current block's height and width. The shape of the current block can be determined based on whether the current block's width and height are the same. All syntax elements for coefficient encoding can include syntax elements for specifying the scan region and syntax elements related to the transform coefficients in the scan region.

[0309] For example, the entropy coding unit 155 can determine the information size_tu1 related to the size of the current block based on the following equation 11.

[0310] Equation 11

[0311]

[0312] The entropy coding unit 155 can determine a context model corresponding to the information size_tu1 related to the size of the current block, and determine a context model related to the syntax elements used for coefficient encoding, and perform binary arithmetic encoding on the syntax elements used for coefficient encoding by using the context model.

[0313] Alternatively, the entropy coding unit 155 can determine the information size_tu2 related to the size of the current block based on the following equation 12.

[0314] Equation 12

[0315]

[0316] The entropy coding unit 155 can determine the context model based on the information size_tu2 related to the size of the current block, and determine the context model related to the syntax elements used for coefficient encoding, and perform binary arithmetic encoding on the syntax elements used for coefficient encoding by using the context model.

[0317] Alternatively, the entropy coding unit 155 may determine the context model based on information size_tu1 and size_tu2 related to the size of the current block, and determine the context model related to the syntax elements used for coefficient encoding, and perform binary arithmetic encoding on the syntax elements used for coefficient encoding by using the context model.

[0318] Entropy coding unit 155 can determine which is the minimum and which is the maximum value among the size and height of the current block, determine the context model based on the minimum and maximum values ​​among the size and height of the current block, determine the context model related to the syntax elements used for coefficient encoding, and perform binary arithmetic encoding on the syntax elements used for coefficient encoding by using the context model.

[0319] Entropy coding unit 155 can determine the context model used in the binary arithmetic coding of all syntax elements used for coefficient coding based on the shape of the current block.

[0320] For example, the entropy coding unit 155 can determine the information shape_tu related to the shape of the current block based on the following equation 13.

[0321] Equation 13

[0322]

[0323] According to Equation 13, the entropy coding unit 155 determines shape_tu to be 2 when the width of the current block is greater than its height, determines shape_tu to be 1 when the width of the current block is less than its height, and determines shape_tu to be 0 when the width of the current block is equal to its height. In other words, in the case of a rectangle whose width is greater than its height, shape_tu can be determined to be 2; in the case of a rectangle whose height is greater than its width, shape_tu can be determined to be 1; and in the case of a square, shape_tu can be determined to be 0.

[0324] The entropy coding unit 155 can determine the context model based on the information shape_tu related to the shape of the current block, and determine the context model related to the syntax elements used for coefficient encoding, and perform binary arithmetic encoding on the syntax elements used for coefficient encoding by using the context model.

[0325] The entropy coding unit 155 can determine a context model related to the syntax elements used for coefficient encoding based on the size and shape of the current block. For example, the entropy coding unit 155 can determine a context model related to the syntax elements used for coefficient encoding based on at least one of the information size_tu1 and size_tu2 related to the size of the current block and the information shape_tu related to the shape of the current block, and perform binary arithmetic encoding on the syntax elements used for coefficient encoding by using the context model.

[0326] When the height and width of the current block are different, i.e., when one of the height and width is larger, the entropy coding unit 155 can swap the height and width of the current block. In other words, the horizontal and vertical coordinates of the pixels included in the current block can be swapped. For example, when the width of the current block is greater than its height, the entropy coding unit 155 can swap the height and width of the current block. In other words, the horizontal and vertical coordinates of the pixels included in the current block can be swapped. Furthermore, when the width of the current block is not greater than its height, the entropy coding unit 155 may not swap the horizontal and vertical coordinates of the pixels included in the current block. However, it is not limited to this; when the height of the current block is greater than its width, the entropy coding unit 155 can swap the height and width of the current block. In other words, the horizontal and vertical coordinates of the pixels included in the current block can be swapped. When the horizontal and vertical coordinates of pixels included in the current block are interchanged, the entropy encoding unit 155 can swap the horizontal and vertical coordinates of the scan area of ​​the specified current block. The entropy encoding unit 155 can determine a first scan area in the swapped current block based on the swapped coordinates of the specified scan area. The entropy encoding unit 155 can scan information related to the transform coefficients included in the first scan area and perform entropy encoding on the information related to the scanned transform coefficients. The entropy encoding unit 155 can determine the coordinates for the specified quadrilateral scan area and perform entropy encoding on the information related to the coordinates of the specified quadrilateral scan area. In other words, the entropy encoding unit 155 can generate a binary string by performing binarization based on a predetermined binarization method on the syntax elements related to the coordinates of the specified quadrilateral scan area. Here, the predetermined binarization method can be at least one of fixed-length binarization and truncated unary code binarization methods.

[0327] Entropy coding unit 155 can perform context-model-based binary arithmetic encoding on a binary string associated with a syntax element used to specify the coordinates of a quadrilateral scan region. In this case, the context model can be determined based on at least one of the current block size, the current block's color components, and a binary index. The color components may include a luminance component and a chromatic aberration component. The binary index may be information indicating the position of the currently binary-arithmetically encoded bin in the binary string associated with the syntax element.

[0328] Entropy coding unit 155 can generate entropy-coded information by performing at least one of binary arithmetic coding based on a context model related to binarization and transform coefficients, based on information related to the transform coefficients of the scan.

[0329] When the first information related to the transform coefficients is information indicating whether the absolute value of the current transform coefficient is greater than a predetermined value, residual level absolute value information, and sign information of the current transform coefficients, and the second information related to the transform coefficients is binarization parameter information of the residual level absolute value, the entropy coding unit 155 can generate a binary string about the first information by performing binarization based on the second information on the first information related to the transform coefficients. The entropy coding unit 155 can generate entropy-coded information by performing binary arithmetic coding on the binary string related to the first information.

[0330] The second information can be determined based on at least one of the following: information related to at least one previously scanned transform coefficient in a predetermined scanning order, the position of the first transform coefficient in the current block, the color component, information related to neighboring transform coefficients located to the right or below, and the scan position of the first transform coefficient. For example, binarization parameter information related to the remaining level absolute value of the first transform coefficient can be determined based on the level absolute value of neighboring valid transform coefficients to the right or below the first transform coefficient. Binarization parameter information related to the remaining level absolute value of the first transform coefficient can be determined based on the sum of the level absolute values ​​of surrounding valid transform coefficients to the right or below the first transform coefficient.

[0331] Alternatively, the binarization parameter information related to the absolute value of the remaining level of the first transform coefficient can be determined based on at least one of the following: the levels of the n (n is an integer) transform coefficients previously scanned in a predetermined scanning order, the position of the first transform coefficient in the current block, the levels of the color component and the n (n is a positive integer) transform coefficients adjacent to the right or bottom, whether the first transform coefficient is the transform coefficient at the initial position in the scanned area in the scanning order, whether the first transform coefficient is the transform coefficient at the final position in the scanned area in the scanning order, and whether the first transform coefficient is the coefficient at the first position in the coefficient group in the scanning order.

[0332] When the information related to the transform coefficients is information indicating whether the absolute value of the current transform coefficient is greater than a predetermined value, residual level absolute value information, and sign information of the current transform coefficients, the entropy coding unit 155 can perform binarization on the information related to the transform coefficients to generate a binary string. The entropy coding unit 155 can generate binary arithmetic-encoded information by performing binary arithmetic encoding on the binary string based on the context model related to the transform coefficients. The context model related to the first transform coefficient in the context model related to the transform coefficients can be determined based on at least one of the following: at least one piece of information related to the second transform coefficient that was previously scanned according to a predetermined scanning order, the position of the first transform coefficient in the current block, the color component, information related to the neighboring transform coefficients on the right or bottom, and the scanning position of the first transform coefficient.

[0333] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 0 can be determined based on the number of valid transform coefficients to the right or below where the absolute value is greater than 0.

[0334] The entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 0 based on the position of the first transform coefficient in the current block. For example, when the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred1, the entropy coding unit 155 can increase the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred2, the entropy coding unit 155 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred3, the entropy coding unit 155 can increase the context index by a predetermined context offset offset3 and determine the context model based on the increased context index.

[0335] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 0 based on at least one of the size of the scan region, the number of transform coefficients already scanned in the scan region, the relative position of the first transform coefficient in the scan region, and whether the first transform coefficient is the first coefficient scanned according to a predetermined scan order.

[0336] For example, the entropy coding unit 155 can determine the size_sr of the quadrilateral scan region based on the following equation 14. In other words, the size_sr of the quadrilateral scan region can represent the number of transform coefficients included in the quadrilateral scan region.

[0337] Equation 14

[0338]

[0339] However, not limited to this, when the scan area is specified by the coordinates of the last valid transform coefficient pixel, size_sr can refer to the number of transform coefficients included in that scan area.

[0340] The entropy coding unit 155 can determine the number of all transform coefficients scanned before scanning the first transform coefficient within the quadrilateral scan region, cnt_pos. At this time, cnt_pos can indicate the position of the first transform coefficient among all transform coefficients scanned in the scan region according to a predetermined scan order.

[0341] When cnt_pos is less than a predetermined threshold thred1, the entropy coding unit 155 can increment the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. In this case, thred1 can be 1. Alternatively, thred1 can be 1 / 4 × size_sr.

[0342] When cnt_pos is less than a predetermined threshold thred2, the entropy coding unit 155 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. In this case, thred2 can be 1 / 4 × size_sr. Alternatively, thred2 can be 1 / 2 × size_sr.

[0343] When cnt_pos is not less than predetermined thresholds thred1 and thred2, the entropy coding unit 155 can add a predetermined context offset 3 to the context index and determine the context model based on the added context index. However, the thresholds thred1 and thred2 are merely an example, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr.

[0344] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 0 based on the relative position of the first transform coefficient in the scan area.

[0345] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 0 based on the horizontal coordinate value pos_x and the vertical coordinate value pos_y of the first transform coefficient in the current block, as well as the coordinates Sr_x and Sr_y of the specified quadrilateral scan region.

[0346] When pos_x is less than thred1_x and pos_y is less than thred1_y, the entropy coding unit 155 can increment the context index by a predetermined context offset offset1 and determine the context model based on the incremented context index. In this case, [thred1_x, thred1_y] can be [1, 1]. Alternatively, [thred1_x, thred1_y] can be [sr_x / 4, sr_y / 4] or [(sr_x+1) / 4, (sr_y+1) / 4].

[0347] When pos_x is less than thred2_x and pos_y is less than thred2_y, the entropy coding unit 155 can add a predetermined context offset 2 to the context index and determine the context model based on the added context index. At this time, [thred2_x, thred2_y] or [thred1_x, thred1_y] can be [sr_x / 2, sr_y / 2] or [(sr_x+1) / 2, (sr_y+1) / 2].

[0348] However, the thresholds thred1_x, thred1_y, and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on sr_x and sr_y.

[0349] The entropy coding unit 155 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 0 based on whether the first transform coefficient is the transform coefficient of the first position scanned in reverse scanning order. In other words, the entropy coding unit 155 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 0 when the first transform coefficient is the transform coefficient of the first position scanned in reverse scanning order, and determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 0 when the first transform coefficient is not the transform coefficient of the first position scanned in reverse scanning order. In this case, the transform coefficient of the pixel located at the lower right corner of the quadrilateral scanning area can be the transform coefficient of the first position scanned in reverse scanning order.

[0350] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 0 can be determined based on the number of valid transform coefficients with an absolute value greater than 0 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0351] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients to the right or below that have an absolute value greater than 1.

[0352] The entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 1 based on the position of the first transform coefficient in the current block. For example, when the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred1, the entropy coding unit 155 can increase the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred2, the entropy coding unit 155 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index.

[0353] When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred3, the entropy coding unit 155 can increase the context index by a predetermined context offset offset3 and determine the context model based on the increased context index. At this time, the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transform coefficient is greater than 1, and the predetermined thresholds thred1, 2, and 3, can be different from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transform coefficient is greater than 0, and the predetermined thresholds thred1, 2, and 3.

[0354] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 1 based on at least one of the size of the scan region, the number of transform coefficients that have been scanned in the scan region, the relative position of the first transform coefficient in the scan region, and whether the first transform coefficient is the first non-zero transform coefficient scanned in a predetermined scan order.

[0355] For example, the entropy coding unit 155 can determine the size_sr of the quadrilateral scan region based on the following equation 15. In other words, the size_sr of the quadrilateral scan region can represent the number of transform coefficients included in the quadrilateral scan region.

[0356] Equation 15

[0357]

[0358] The entropy coding unit 155 can determine the number of all transform coefficients scanned before scanning the first transform coefficient within the quadrilateral scan region, cnt_pos. In this case, cnt_pos can indicate the position of the first transform coefficient among all transform coefficients scanned in the scan region according to a predetermined scan order. However, it is not limited to this; cnt_pos can also be the number of all transform coefficients greater than 0 scanned before scanning the first transform coefficient within the quadrilateral scan region.

[0359] When cnt_pos is less than a predetermined threshold thred1, the entropy coding unit 155 can increment the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. In this case, thred1 can be 1. Alternatively, thred1 can be 1 / 4 × size_sr.

[0360] When cnt_pos is less than a predetermined threshold thred2, the entropy coding unit 155 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. In this case, thred2 can be 1 / 4 × size_sr. Alternatively, thred2 can be 1 / 2 × size_sr.

[0361] When cnt_pos is not less than the predetermined thresholds thred1 and thred2, the entropy coding unit 155 can add a predetermined context offset 3 to the context index and determine the context model based on the added context index.

[0362] However, the thresholds thred1 and thred2 are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 1, and the predetermined thresholds thred1 and thred2, can differ from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0, and the predetermined thresholds thred1 and thred2.

[0363] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 1 based on the relative position of the first transform coefficient in the scanning region.

[0364] The entropy coding unit 155 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on the horizontal coordinate value pos_x and the vertical coordinate value pos_y of the first transform coefficient in the current block, as well as the coordinates Sr_x and Sr_y of the specified quadrilateral scan region.

[0365] When pos_x is less than thred1_x and pos_y is less than thred1_y, the entropy coding unit 155 can add a predetermined context offset 1 to the context index and determine the context model based on the added context index. In this case, [thred1_x, thred1_y] can be [1, 1]. Alternatively, [thred1_x, thred1_y] can be [sr_x / 4, sr_y / 4] or [(sr_x+1) / 4, (sr_y+1) / 4].

[0366] When pos_x is less than thred2_x and pos_y is less than thred2_y, the entropy coding unit 155 can add a predetermined context offset 2 to the context index and determine the context model based on the added context index. At this time, [thred2_x, thred2_y] or [thred1_x, thred1_y] can be [sr_x / 2, sr_y / 2] or [(sr_x+1) / 2, (sr_y+1) / 2].

[0367] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on sr_x and sr_y.

[0368] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 1, and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y, can differ from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0, and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y.

[0369] The entropy coding unit 155 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on whether the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order. In other words, the video decoding device 100 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order, and determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is not the first position among the transform coefficients greater than 0 scanned in reverse scanning order.

[0370] However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 1 can be determined based on the number of valid transform coefficients with an absolute value greater than 1 among the n (n is a positive integer) transform coefficients that have been scanned previously in a predetermined scanning order.

[0371] The context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients to the right or below that have an absolute value greater than 2.

[0372] The entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 2 based on the position of the first transform coefficient in the current block. For example, when the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred1, the entropy coding unit 155 can increase the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred2, the entropy coding unit 155 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. When the sum of the horizontal coordinate value pos_x and the vertical position pos_y of the first transform coefficient in the current block is less than a predetermined threshold thred3, the entropy coding unit 155 can increase the context index by a predetermined context offset offset3 and determine the context model based on the increased context index. At this point, the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 2, and the predetermined thresholds thred1, 2, and 3, may be different from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 and 1, and the predetermined thresholds thred1, 2, and 3.

[0373] The entropy coding unit 155 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 1 based on at least one of the size of the scan region, the number of transform coefficients that have been scanned in the scan region, the relative position of the first transform coefficient in the scan region, and whether the first transform coefficient is the first non-zero (or the first position among transform coefficients greater than 1) transformed coefficient scanned in a predetermined scan order.

[0374] For example, the entropy coding unit 155 can determine the size_sr of the quadrilateral scan region based on the following equation 16. In other words, the size_sr of the quadrilateral scan region can represent the number of transform coefficients included in the quadrilateral scan region.

[0375] Equation 16

[0376]

[0377] The entropy coding unit 155 can determine the number of all transform coefficients scanned before scanning the first transform coefficient within the quadrilateral scan region, cnt_pos. In this case, cnt_pos can indicate the position of the first transform coefficient among all transform coefficients scanned in a predetermined scan order within the scan region. However, it is not limited to this; cnt_pos can also be the number of all transform coefficients with an absolute value greater than 1 scanned before scanning the first transform coefficient within the quadrilateral scan region.

[0378] When cnt_pos is less than a predetermined threshold thred1, the entropy coding unit 155 can increment the context index by a predetermined context offset offset1 and determine the context model based on the increased context index. In this case, thred1 can be 1. Alternatively, thred1 can be 1 / 4 × size_sr.

[0379] When cnt_pos is less than a predetermined threshold thred2, the entropy coding unit 155 can increase the context index by a predetermined context offset offset2 and determine the context model based on the increased context index. In this case, thred2 can be 1 / 4 × size_sr. Alternatively, thred2 can be 1 / 2 × size_sr.

[0380] When cnt_pos is not less than the predetermined thresholds thred1 and thred2, the entropy coding unit 155 can add a predetermined context offset 3 to the context index and determine the context model based on the added context index.

[0381] However, the thresholds thred1 and thred2 are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 or 1, and the predetermined thresholds thred1 and thred2, can differ from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 or 1, and the predetermined thresholds thred1 and thred2.

[0382] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 2 based on the relative position of the first transform coefficient in the scan area.

[0383] Entropy coding unit 155 can determine a context model related to flag information indicating whether the first transform coefficient is greater than 2 based on the horizontal coordinate value pos_x and the vertical coordinate value pos_y of the first transform coefficient in the current block, as well as the coordinates Sr_x and Sr_y of the specified quadrilateral scan area.

[0384] When pos_x is less than thred1_x and pos_y is less than thred1_y, the entropy coding unit 155 can add a predetermined context offset 1 to the context index and determine the context model based on the added context index. In this case, [thred1_x, thred1_y] can be [1, 1]. Alternatively, [thred1_x, thred1_y] can be [sr_x / 4, sr_y / 4] or [(sr_x+1) / 4, (sr_y+1) / 4].

[0385] When pos_x is less than thred2_x and pos_y is less than thred2_y, the entropy coding unit 155 can add a predetermined context offset 2 to the context index and determine the context model based on the added context index. At this time, [thred2_x, thred2_y] or [thred1_x, thred1_y] can be [sr_x / 2, sr_y / 2] or [(sr_x+1) / 2, (sr_y+1) / 2].

[0386] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on sr_x and sr_y.

[0387] However, the thresholds thred1_x, thred1_y and thred2_x, thred2_y are merely examples, and those skilled in the art will readily understand that various values ​​can be determined based on size_sr. In this case, those skilled in the art will readily understand that the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 or 1, and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y, can differ from the offsets offset1, 2, and 3 associated with the context model regarding flag information indicating whether the first transformation coefficient is greater than 0 and the predetermined thresholds thred1_x, thred1_y, thred2_x, and thred2_y.

[0388] The entropy coding unit 155 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 2 based on whether the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order. In other words, the entropy coding unit 155 can determine a first context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is the first position among the transform coefficients greater than 0 scanned in reverse scanning order, and determine a second context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is not the first position among the transform coefficients greater than 0 scanned in reverse scanning order.

[0389] However, not limited to this, the entropy coding unit 155 can determine a context model related to the flag information indicating whether the first transform coefficient is greater than 2 based on whether the first transform coefficient is the first position among transform coefficients greater than 1 scanned in reverse scanning order. In other words, the entropy coding unit 155 determines a first context model related to the flag information indicating whether the first transform coefficient is greater than 1 when the first transform coefficient is the first position among transform coefficients greater than 1 scanned in reverse scanning order, and determines a second context model related to the flag information indicating whether the first transform coefficient is greater than 2 when the first transform coefficient is not the first position among transform coefficients greater than 1 scanned in reverse scanning order. However, not limited to this, the context model related to the flag information indicating whether the first transform coefficient is greater than 2 can be determined based on the number of valid transform coefficients with an absolute value greater than 2 among n (n is a positive integer) transform coefficients previously scanned according to a predetermined scanning order.

[0390] When the position of the currently scanned transform coefficient in the scanning area is [SRx, 0] (SRx is an integer, SRx indicates the horizontal coordinate value of the right boundary pixel of the scanning area based on the coordinates of the left upper corner of the scanning area), and the transform coefficients at the previously scanned positions [SRx, Y] (Y is an integer greater than 0 and less than or equal to SRy, SRy indicates the vertical coordinate value of the lower boundary pixel of the scanning area based on the coordinates of the left upper corner of the scanning area) are all 0, the entropy coding unit 155 may not generate GTO flag information for the currently scanned transform coefficient.

[0391] Similarly, when the position of the currently scanned transform coefficient in the scanning area is [0, SRy] (SRy is an integer, SRy indicates the vertical coordinate value of the lower boundary pixel of the scanning area based on the coordinates of the upper left corner of the scanning area), and the transform coefficients of the previously scanned position [X, SRy] (X is an integer greater than 0 and less than or equal to SRx, SRx indicates the vertical coordinate value of the right boundary pixel of the scanning area based on the coordinates of the upper left corner of the scanning area) are all 0 according to the predetermined scanning order, the entropy coding unit 155 may not generate GTO flag information for the currently scanned transform coefficients.

[0392] The entropy coding unit 155 can determine the maximum number of GT1 flag information for valid transform coefficients in the current block, and generate GT1 flag information for the current block within the determined maximum number of valid transform coefficients. In other words, when the entropy coding unit 155 generates the maximum number of GT1 flag information for valid transform coefficients, the entropy coding unit 155 may not generate GT1 flag information for valid transform coefficients thereafter.

[0393] The entropy coding unit 155 can determine the maximum number of GT1 flags in the current block by considering all valid transform coefficients that are not zero. Alternatively, the entropy coding unit 155 can determine the maximum number of GT1 flags in the current block based on the size of the scan region. For example, the entropy coding unit 155 can determine the maximum number of GT1 flags, MaxCount_GT1, based on the following equation 17.

[0394] Equation 17

[0395]

[0396] At this point, sizeSR can represent the size (area) of the quadrilateral scanning region, and sizeSR can be (Sr_x+1)×(Sr_y+1). Sr_x can represent the horizontal coordinate of the rightmost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_x can represent the horizontal coordinate of the rightmost boundary pixel based on the coordinates of the upper left corner of the scanning region. Sr_y can represent the vertical coordinate of the lowermost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_y can represent the vertical coordinate of the lower boundary pixel based on the coordinates of the upper left corner of the scanning region. K1 can be an adjustment coefficient between the size of the scanning region and the GT1 flag. For example, K1 can be an integer greater than 1. Th1 can be a predetermined threshold. For example, Th1 can be 16 or 8. However, it is not limited to this. Those skilled in the art will readily understand that K1 and Th1 can have various values.

[0397] The entropy coding unit 155 can determine the maximum number of GT2 flag information in the current block, and generate GT2 flag information in the current block within the determined maximum coefficient of valid transform coefficients. In other words, when the entropy coding unit 155 generates the maximum number of GT2 flag information for valid transform coefficients, the entropy coding unit 155 may not generate GT2 flag information for valid transform coefficients thereafter.

[0398] The entropy coding unit 155 can determine the maximum number of GT2 flags in the current block as all valid transform coefficients that are not zero. Alternatively, the entropy coding unit 155 can determine the maximum number of GT2 flags in the current block based on the size of the scan region. For example, the entropy coding unit 155 can determine the maximum number of GT2 flags, MaxCount_GT2, based on the following equation 18.

[0399] Equation 18

[0400]

[0401] At this point, sizeSR can represent the size (area) of the quadrilateral scanning region, and sizeSR can be (Sr_x+1)×(Sr_y+1). Sr_x can represent the horizontal coordinate of the rightmost effective transform coefficient pixel based on the coordinates of the upper left corner of the scanning region. In other words, Sr_x can represent the horizontal coordinate of the rightmost boundary pixel based on the coordinates of the upper left corner of the scanning region. Sr_y can represent the vertical coordinate of the lowermost effective transform coefficient pixel based on the upper left corner of the scanning region. In other words, Sr_y can represent the vertical coordinate of the lower boundary pixel based on the coordinates of the upper left corner of the scanning region. K2 can be an adjustment coefficient between the size of the scanning region and the GT1 flag. For example, K2 can be an integer greater than 1. Th2 can be a predetermined threshold. For example, Th2 can be 16 or 8. However, it is not limited to this. Those skilled in the art will readily understand that K2 and Th2 can have various values.

[0402] The entropy encoding unit 155 can generate information related to coefficient groups in the current block. This information may include flag information indicating whether the coefficient group includes at least one valid transform coefficient. In this case, for transform coefficients included in the scanned region, the entropy encoding unit 155 can determine a coefficient group based on every predetermined K (K is an integer) transform coefficients scanned in the scan order. That is, a coefficient group may include K transform coefficients. The scan order may be a forward scan order that is the opposite of a predetermined reverse scan order. Here, the predetermined reverse scan order can be the order from the lower right coefficients in the current block to the upper left coefficients in the current block.

[0403] Therefore, the entropy coding unit 155 can determine the coefficient group by scanning from the DC coefficients, which are adjacent to the upper left corner of the current block, in a forward scanning order. At this time, when the number of transform coefficients included in the current block is not an integer multiple of K, the final coefficient group in the coefficient group according to the forward scanning order can include transform coefficients with a number less than K. However, it is not limited to this; those skilled in the art will readily understand that the entropy coding unit 155 can determine the coefficient group by scanning from the coefficients located at the lower right end of the transform coefficients included in the current block to the coefficients located at the upper left end of the transform coefficients included in the current block, in a reverse scanning order.

[0404] When a coefficient group in a coefficient group being scanned in a predetermined scanning order contains only one transform coefficient, the entropy coding unit 155 can directly generate GTO flag information without generating information related to that coefficient group.

[0405] The entropy coding unit 155 can determine whether to hide the sign of at least one transform coefficient for each coefficient group included in the current block. For example, the entropy coding unit 155 can determine, depending on the situation, to hide the sign of one or two transform coefficients for each coefficient group included in the current block.

[0406] The entropy encoding unit 155 can scan information related to the transform coefficients in the quadrilateral scanning region according to a predetermined scanning order. The predetermined scanning order may include a reverse zigzag scanning order, a reverse diagonal scanning order, and a reverse vertical and horizontal scanning order. However, the predetermined scanning order is not limited to the aforementioned reverse scanning order, and it will be readily understood by those skilled in the art to include various reverse scanning orders.

[0407] The bitstream generation unit 170 can generate a bitstream that includes entropy-encoded information. In other words, the bitstream generation unit 170 can generate a bitstream that includes entropy-encoded information scanned in the entropy encoding unit 160 related to the transform coefficients and based on the scanned information related to the transform coefficients.

[0408] The bitstream generation unit 170 can generate a bitstream that includes coordinate-related information, which specifies the scan area used to scan the region related to the transform coefficients.

[0409] The video encoding apparatus 150 may include an image encoding unit (not shown), and the image encoding unit (not shown) may include an entropy encoding unit 155 and a bitstream generation unit 170. The image encoding unit will be described with reference to 1f.

[0410] Figure 1d A flowchart of a video encoding method according to various embodiments is shown.

[0411] refer to Figure 1d In step S150, the video encoding device 150 can obtain the transform coefficients of the current block. The current block can be obtained by referring to... Figures 10 to 23 The data units described are used in the process of encoding / decoding an image. The video encoding apparatus 150 can generate a prediction block for the current block by performing inter-frame prediction or intra-frame prediction, and generate a residual block for the current block based on the original block and the prediction block. The video encoding apparatus 150 can generate transform coefficients for the current block by performing transform and quantization on the residual block.

[0412] In step S155, the video encoding device 150 can determine a scan region that includes all valid transform coefficients in the current block. At this time, the scan region can include all valid transform coefficients in the current block, and the remaining regions in the current block other than the scan region can include only 0, which are not valid transform coefficients.

[0413] In step S160, the video encoding apparatus 150 may scan information related to the transform coefficients in the scanning area according to a predetermined scanning order. The information related to the transform coefficients may include flag information indicating whether the transform coefficient is greater than a predetermined value. In this case, the predetermined value may be at least one of 0, 1, and 2. It may include at least one of residual level information related to the absolute value of the transform coefficient, sign information of the transform coefficient, and binarization parameter information of the absolute value of the residual level. The predetermined scanning order may include a reverse zigzag scanning order, a reverse diagonal scanning order, and a reverse vertical scanning order and a horizontal scanning order. However, the predetermined scanning order is not limited to the aforementioned reverse scanning order, and it will be readily understood by those skilled in the art to include various reverse scanning orders.

[0414] In step S165, the video encoding device 150 can perform binarization based on information related to the scanned transform coefficients to generate binarized information.

[0415] In step S170, the video encoding device 150 can generate entropy-encoded information by performing binary arithmetic encoding on the binarized information. At this time, the video encoding device 150 can perform binary arithmetic encoding using a context model determined based on at least one of the size and shape of the current block.

[0416] In step S175, the video encoding apparatus 150 can generate a bitstream including entropy-coded information. The video encoding apparatus 150 can generate a bitstream including entropy-coded information scanned in the entropy coding unit 160 related to transform coefficients and based on the scanned information related to transform coefficients. The video encoding apparatus 150 can generate a bitstream including coordinate-related information, which specifies a scan area used to scan the region related to transform coefficients.

[0417] Figure 1e A block diagram of an image decoding unit 6000 according to various embodiments is shown.

[0418] The image decoding unit 6000 according to various embodiments performs the operation of encoding image data by the image decoding unit (not shown) of the video decoding device 100.

[0419] refer to Figure 1e The entropy decoding unit 6150 can parse the encoded image data, which is the object of decoding, and the encoded information required for decoding from the bitstream 6050. The encoded image data is quantized transform coefficients, and the dequantization unit 6200 and the inverse transform unit 6250 can recover the residual data from the quantized transform coefficients. Figure 1e The entropy decoding unit 6150 can correspond to Figure 1a Entropy decoding unit 105.

[0420] Intra-frame prediction unit 6400 performs intra-frame prediction block by block. Inter-frame prediction unit 6350 can perform inter-frame prediction using a block-by-block reference image obtained from the recovery frame buffer 6300. The spatial domain data of the current image 6050 blocks can be recovered by adding the block-by-block prediction data and residual data generated by the intra-frame prediction unit 6400 or the inter-frame prediction unit 6350. The deblocking unit 6450 and the Sample Adaptive Offset (SAO) execution unit 6500 can output a filtered recovered image by performing loop filtering on the recovered spatial domain data. Furthermore, the recovered image stored in the recovery frame buffer 6300 can be output as a reference image.

[0421] In order to perform decoding on image data in the decoding unit (not shown) of the video decoding apparatus 100, the operation of each step of the image decoding unit 6000 according to various embodiments can be performed on each block.

[0422] Figure 1f A block diagram of an image encoding unit according to various embodiments is shown.

[0423] The image encoding unit 7000 according to various embodiments performs the operations performed by the image encoding unit (not shown) of the video encoding device 150 to encode the image data.

[0424] In other words, the intra-frame prediction unit 7200 performs intra-frame prediction on the current image 7050 in blocks, and the inter-frame prediction unit 7150 can perform inter-frame prediction on blocks using the current image 7050 and the reference image obtained from the recovery frame buffer 7100.

[0425] Residual data can be generated by subtracting the prediction data for each block output from the intra-prediction unit 7200 or the inter-prediction unit 7150 from the data of the encoded blocks of the current image 7050. The transform unit 7250 and the quantization unit 7300 can output transform coefficients quantized according to the blocks by performing transform and quantization on the residual data. The inverse quantization unit 7450 and the inverse transform unit 7500 can perform inverse quantization and inverse transform on the quantized transform coefficients to recover the spatial domain residual data. The recovered spatial domain residual data can be added to the prediction data for each block output from the intra-prediction unit 7200 or the inter-prediction unit 7150 to recover the spatial domain data for the blocks of the current image 7050. The deblocking unit 7550 and the SAO execution unit 7600 generate a filtered restored image by performing loop filtering on the restored spatial domain data. The generated restored image is stored in the restored image buffer 7100. The restored image stored in the restored image buffer 7100 can be used as a reference image for inter-frame prediction of other images. The entropy coding unit 7350 performs entropy coding on the quantized transform coefficients, and the entropy-coded coefficients can be output to the bitstream 7400. Figure 1f The entropy coding unit 7350 can correspond to Figure 1c The entropy coding unit is 155.

[0426] In order to apply the image encoding unit 7000 according to various embodiments to the video encoding apparatus 150, the operation of each step of the image encoding unit 7000 according to various embodiments can be performed in blocks.

[0427] In the following text, Figure 2 and Figures 3a to 3b The method for describing the transform coefficients in the scan block is described in detail, assuming that the “0” and “1” shown in the pixels of the current block are the values ​​of the valid transform coefficient flag (a flag indicating whether the absolute value of the coefficient is greater than 0).

[0428] Figure 2 A schematic diagram is shown to illustrate a method for explaining the transformation coefficients within a scan block according to one embodiment.

[0429] refer to Figure 2 The current block 200 is a block containing multiple transform coefficients. The current block 200 is a data unit for performing the inverse transform operation and can be a block of size M×N (M, N are positive integers). For example, as... Figure 2 As shown, the current block 200 can be a block with a size of 16×16.

[0430] The video decoding device 100 can divide the current block 200 into coefficient groups (or sub-blocks) 205 with predetermined sizes. The coefficient group can be a block of size X×Y (where X and Y are positive integers). For example, ... Figure 2As shown, coefficient group 205 can be a block with a size of 4×4.

[0431] The video decoding device 100 can obtain from the bitstream information about the coordinates of the pixel 210 of the final valid transform coefficient among all valid transform coefficients scanned during the forward scanning sequence of the current block 200 from the transform coefficient located at the upper left end to the transform coefficient located at the lower right end. The information related to the coordinates of the pixel 210 of the final valid transform coefficient may include information related to the horizontal coordinates of the pixel of the final valid transform coefficient and information related to the vertical coordinates of the pixel of the final valid transform coefficient.

[0432] The video decoding device 100 can obtain the coordinates of the pixel 210 of the final effective transform coefficient based on information related to the coordinates of the pixel 210 of the final effective transform coefficient, and scan the information of the transform coefficients from the effective transform coefficients of the final effective transform coefficient 210 in a predetermined reverse scanning order 215 based on the coordinates of the pixel 210 of the final effective transform coefficient. For example, as Figure 2 As shown, the predetermined reverse scanning sequence 215 can be a diagonal scanning sequence in the reverse direction.

[0433] The video decoding apparatus 100 can scan coefficient groups 205 according to a predetermined scanning order, and can scan each coefficient group 205 according to the predetermined scanning order. The video decoding apparatus 100 can scan information related to the coefficient groups according to the predetermined scanning order. Information related to the coefficient groups can be obtained or derived from the bitstream. The information related to the coefficient groups can be derived to indicate that the first and last coefficient groups scanned in the forward (reverse) scanning order include at least one valid transform coefficient. In other words, the information related to the coefficient groups may be excluded from the bitstream for the first and last coefficient groups scanned in the forward (reverse) scanning order.

[0434] At this time, the video decoding device 100 can determine a predetermined reverse scanning order based on at least one of the block size and prediction mode. For example, when the current block size is 4×4 and the current block prediction mode is intra-frame prediction mode, the video decoding device 100 can determine one of the horizontal scanning order, vertical scanning order, or diagonal scanning order as the predetermined reverse scanning order. Furthermore, when the current block size is 8×8 and the current block prediction mode is intra-frame prediction mode, the video decoding device 100 can determine one of the horizontal scanning order, vertical scanning order, or diagonal scanning order as the predetermined reverse scanning order.

[0435] When the size of the current block is not 4×4 or 8×8, or the prediction mode of the current block is not inter-frame prediction mode, the video decoding device 100 can determine the diagonal scanning order in the reverse direction as the predetermined scanning order.

[0436] When information related to coefficient group 205 indicates that at least one valid coefficient is included in coefficient group 205, video decoding device 100 can scan information related to the valid coefficients in coefficient group 205 in a predetermined scanning order 215 in reverse direction.

[0437] Additionally, the video decoding device 100 can determine whether the sign of at least one of the valid transform coefficients included in each coefficient group 205 is hidden.

[0438] Figure 3a A schematic diagram is shown illustrating a method for explaining the transformation coefficients within a scan block according to another embodiment.

[0439] refer to Figure 3a The current block 300 is a block containing multiple transform coefficients. The current block 300 is a data unit for performing the inverse transform operation and can be a block of size M×N (M and N are positive integers). For example, as shown in Figure 3, the current block 300 can be a block of size 16×16.

[0440] refer to Figure 3a The video decoding device 100 can determine a quadrilateral scanning region 340 that includes all valid transform coefficients present in the current block 300. At this time, the quadrilateral scanning region 340 can be determined by the coordinates of the pixel 330 located at the lower right end of the quadrilateral scanning region 340. The horizontal coordinates of the pixel 330 located at the lower right end of the scanning region 340 can be the horizontal coordinates of the rightmost valid transform coefficient pixel 320 among all valid transform coefficients in the current block 300. The vertical coordinates of the pixel 330 located at the lower right end of the scanning region 340 can be the vertical coordinates of the bottommost valid transform coefficient pixel 310 among all valid transform coefficients in the current block 300. Information about pixel 330 can include information about the position of the upper left corner of pixel 330. However, it is not limited to this; information about pixel 330 can also include information about the position of the lower right corner of pixel 330.

[0441] The video decoding apparatus 100 can receive information from the bitstream relating to the coordinates of pixels 330 used to specify a quadrilateral scanning region 340, and can determine the quadrilateral scanning region 340 based on the received information relating to pixels 330. The video decoding apparatus 100 can scan information relating to transform coefficients from pixel 330 to pixel 345 located at the upper left end of the quadrilateral scanning region 340 in a predetermined reverse scanning order. At this time, every K (K is a positive integer) scan coefficients scanned from the upper left end of the quadrilateral scanning region 340 in a forward scanning order can be determined as a coefficient group. However, this is not a limitation; those skilled in the art will readily understand that every K (K is a positive integer) scan coefficients scanned from the lower right end of the quadrilateral scanning region 340 in a reverse scanning order can also be determined as a coefficient group. Reference will be made later. Figure 3b Describe the details of the coefficient set.

[0442] The video decoding device 100 can determine for each coefficient group that the sign for at least one valid transform coefficient is hidden, and can recover the sign for the hidden at least one transform coefficient. (See later...) Figure 3b Describe the operation performed for each coefficient group to restore hidden symbols.

[0443] Figure 3b A schematic diagram is shown to illustrate the operation of determining a coefficient group (sub-block) in a block according to an embodiment, and the operation performed according to the coefficient group.

[0444] The video decoding apparatus 100 can determine a coefficient group consisting of K transform coefficient pixels (K being a positive integer) in a predetermined scanning order in the current block 350 in the forward direction. The video decoding apparatus 100 can determine a coefficient group comprising K transform coefficient pixels. For example, as... Figure 3b As shown, the video decoding device 1000 can determine the coefficient group 360 every 16 pixels.

[0445] The video decoding apparatus 100 can determine that a sign for at least one valid transform coefficient is hidden for each coefficient group 360. For example, the video decoding apparatus 100 can determine that a sign for at least one valid transform coefficient is hidden for the current coefficient group based on the distance between previously decoded valid transform coefficients in the current coefficient group. Specifically, the video decoding apparatus 100 can determine that a sign for at least one valid transform coefficient is hidden for the current coefficient group based on the distance between the initial and final valid transform coefficients scanned in a predetermined reverse scanning order. In this case, the distance can be the difference in positions of the coefficients scanned in the reverse scanning order.

[0446] For example, when the distance between the initial valid transform coefficients and the final valid transform coefficients scanned in a predetermined reverse scanning order is greater than a predetermined value, the video decoding device 100 can determine that a sign for at least one valid transform coefficient is hidden for the current coefficient group. In this case, the predetermined value can be any integer value. For example, the predetermined value can be 3.

[0447] When it is determined that at least one symbol for a valid transform coefficient is hidden for the current coefficient group, the video decoding apparatus 100 can recover the hidden symbol for at least one valid transform coefficient in the current coefficient group without obtaining information about the symbol from the bitstream for the current coefficient group. For example, when the parity sum for the level of valid transform coefficients in the current coefficient group is odd or even, the video decoding apparatus 100 can determine the symbol of at least one valid transform coefficient to be 0 or 1. In this case, the recovered symbol of the valid transform coefficient may include the symbol associated with the last valid transform coefficient scanned in reverse scanning order. However, it is not limited to this, and those skilled in the art will readily understand that symbols located at predetermined positions in the coefficient group can be recovered according to a predetermined scanning order.

[0448] The video decoding device 100 can obtain information related to corresponding coefficient groups from the bitstream in a predetermined reverse scanning order, and can scan information related to transform coefficients in the corresponding coefficient group when the information related to the corresponding coefficient group indicates that the coefficient group includes at least one transform coefficient. When the information related to the corresponding coefficient group indicates that the coefficient group includes only transform coefficients with a value of 0, all transform coefficients in the corresponding coefficient group can be determined as 0.

[0449] Furthermore, when the number of transform coefficients included in the quadrilateral scan region of the current block 300 is not an integer multiple of K, the number of transform coefficient pixels may be less than K during the process of determining the last coefficient group in the forward scan order. In this case, the video decoding device 100 can determine a coefficient group 365 that includes transform coefficient pixels with a number less than K. For example, as Figure 3b As shown, the video decoding device 100 can determine a coefficient group 365 that includes two transform coefficients.

[0450] The video decoding device 100 can obtain information related to coefficient groups 355 and 360 from the bitstream. Here, the information related to coefficient groups 355 and 360 may be flag information (valid coefficient group flag information), which indicates whether at least one of the transform coefficients included in coefficient groups 355 and 360 is a valid transform coefficient or whether coefficient groups 355 and 360 only include transform coefficients that are 0.

[0451] Furthermore, when a coefficient group is determined to include only one transform coefficient, the video decoding device 100 can obtain information related to a transform coefficient without obtaining information related to that coefficient group (e.g., valid coefficient group flag information) from the bitstream.

[0452] The video decoding device 100 can determine a context model for performing binary arithmetic decoding on information related to the current coefficient group based on information related to the coefficient groups that were scanned in a predetermined scanning order 355 in reverse direction before the current coefficient group.

[0453] Figure 4 A schematic diagram is shown to illustrate the process of determining a context model for performing context-based binary arithmetic encoding and decoding on information related to transform coefficients, according to one embodiment.

[0454] refer to Figure 4 The video decoding device 100 can determine a context model based on the surrounding transform coefficient pixels 410 to determine information related to the currently scanned transform coefficient pixel 405. Figure 4 In this context, the surrounding transform coefficient pixels 405 can be five pixels located at a predetermined position to the right or below the currently scanned transform coefficient pixel 405. However, this is not a limitation, and those skilled in the art will readily understand that the surrounding transform coefficient pixels 405 can be n pixels (n is a positive integer) located at a predetermined position to the right or below the currently scanned transform coefficient pixel 405.

[0455] For example, the video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 410 whose level absolute value is greater than 0, indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than 0.

[0456] Furthermore, the video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 410 whose level absolute value is greater than 1, indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than 1.

[0457] Furthermore, the video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 410 whose level absolute value is greater than 2, indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than 2.

[0458] The video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 410 whose level absolute value is greater than N, indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than N (N is an integer greater than 2).

[0459] The video decoding device 100 can determine the parameters for performing binarization on the remaining level absolute values ​​of the currently scanned transform coefficient pixel 405 based on the sum of the level absolute values ​​of the surrounding transform coefficient pixels 410. In this case, the binarization parameters can be Ricean parameters.

[0460] Figure 5 A schematic diagram is shown to illustrate the process of determining a context model for performing context-based binary arithmetic encoding and decoding on information related to transform coefficients, according to one embodiment.

[0461] refer to Figure 5 The video decoding device 100 can determine a context model of information related to the currently scanned transform coefficient pixel 505 based on the transform coefficient pixels 510 previously scanned in a predetermined reverse scanning order. For example... Figure 5 As shown, the transform coefficient pixel 510 can be one of the five pixels previously scanned in a predetermined reverse scanning order 515 compared to the currently scanned transform coefficient pixel 505. However, it is not limited to this, and those skilled in the art will readily understand that the transform coefficient pixel 510 can be any n pixels (n is a positive integer) previously scanned in a predetermined reverse scanning order 515. Figure 5 As shown, the predetermined reverse scanning sequence 515 can be a reverse zigzag scanning sequence, but is not limited to this. Furthermore, those skilled in the art will readily understand that the predetermined reverse scanning sequence 515 can include a horizontal scanning sequence, a vertical scanning sequence, and a diagonal scanning sequence, etc. Specifically, the predetermined reverse scanning sequence can be determined as one of multiple scanning sequences based on the magnitude of the horizontal and vertical coordinate values ​​of the specified scanning area.

[0462] For example, the video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 510 whose level absolute value is greater than 0, indicating whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than 0.

[0463] Furthermore, the video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 510 whose level absolute value is greater than 1, indicating whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than 1.

[0464] The video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 510 whose level absolute value is greater than 2, which indicates whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than 2.

[0465] The video decoding device 100 can determine a context model based on the number of coefficient pixels in the surrounding transform coefficient pixels 510 whose level absolute value is greater than N, indicating whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than N (N is an integer greater than 2).

[0466] The video decoding device 100 can determine parameters for performing binarization on the remaining level absolute values ​​of the currently scanned transform coefficient pixel 505 based on the sum of the level absolute values ​​of the surrounding transform coefficient pixels 510. In this case, the binarization parameters can be Riceian parameters.

[0467] Figure 6a A schematic diagram is shown to illustrate a zigzag scanning sequence for scanning information related to valid transformation coefficients in a block, according to one embodiment.

[0468] refer to Figure 6a The video decoding device 100 can scan from the transform coefficient pixel located at the lower right end of the current block 600 to the transform coefficient pixel located at the upper left end of the current block 600 in a zigzag scanning sequence 602, in order to scan information related to the transform coefficient of the current block 600.

[0469] Specifically, following the zigzag scanning sequence 602, the video decoding device 100 scans the pixel 606 to the left of the transform coefficient pixel 604 after scanning the lower right corner of the pixel 604, and after scanning the pixel 606, scans the pixel 608 located diagonally to its upper right. The video decoding device 100 scans the pixel 610 adjacent to the upper side of the pixel 608. The video decoding device 100 scans the pixel 612 located diagonally to the lower right of the pixel. The video decoding device 100 scans the pixel 614, which is located to the left of the pixel in pixel 612 adjacent to the boundary of the current block 600. In a similar manner, following the zigzag scanning sequence 602, the video decoding device 100 can scan information related to the remaining transform coefficient pixels.

[0470] Since the zigzag scanning sequence 602 according to one embodiment scans the left-hand direction pixel 606 immediately following the horizontal pixel 604, the zigzag scanning sequence 602 can be referred to as the horizontal priority zigzag scanning sequence.

[0471] Figure 6b A schematic diagram is shown to illustrate a vertically prioritized zigzag scanning sequence for scanning information related to transformation coefficients in a block, according to another embodiment.

[0472] refer to Figure 6b The video decoding device 100 can scan from the transform coefficient pixel located at the lower right end of the current block 600 to the transform coefficient pixel located at the upper left end of the current block 600 in a zigzag scanning sequence 616 to scan information related to the transform coefficient of the current block 600.

[0473] Specifically, following a zigzag scanning sequence 616, the video decoding device 100 scans the pixel 620 above the transform coefficient pixel 618 at the lower right end, and after scanning pixel 620, scans the pixel 622 located diagonally to its lower left end. The video decoding device 100 scans the pixel 624 to the left of pixel 622. The video decoding device 100 scans the pixel 626 located diagonally to the upper right end of the pixel. The video decoding device 100 scans the pixel 628 located above the pixel in pixel 626 that is adjacent to the boundary of the current block 600. In a similar manner, following the zigzag scanning sequence 616, the video decoding device 100 can scan information about the remaining transform coefficient pixels.

[0474] Since the zigzag scanning sequence 616 according to one embodiment scans the upper direction pixel 620 located immediately in the vertical direction after the scanning pixel 618, the zigzag scanning sequence 616 can be referred to as the vertical priority zigzag scanning sequence.

[0475] Figure 6c A schematic diagram is shown to illustrate the horizontal scanning sequence for scanning information related to transformation coefficients in a block, according to one embodiment.

[0476] refer to Figure 6c The video decoding device 100 can scan from the transform coefficient pixels at the lower right end of the current block 600 to the transform coefficient pixels at the upper left end of the current block 600 in a horizontal scanning sequence 630, in order to scan information related to the transform coefficients of the current block 600.

[0477] Specifically, following the horizontal scanning sequence 630, the video decoding device 100 scans the transform coefficient pixels 632 at the lower right end, then sequentially scans the pixels 634 located in the left direction (which is its horizontal direction), and scans the rightmost pixels 636 in the row immediately preceding it after scanning the pixels in the 634 that are adjacent to the left boundary of the current block 600. The video decoding device 100 scans the pixels 638 located in the left direction (which is its horizontal direction) in the same manner as scanning the pixels 634 in the previous row. Similarly, following the horizontal scanning sequence 630, the video decoding device 100 can scan information about the remaining transform coefficient pixels.

[0478] Figure 6d A schematic diagram is shown to illustrate the vertical scanning sequence for scanning information related to the transformation coefficients in a block, according to one embodiment.

[0479] refer to Figure 6d The video decoding device 100 can scan from the transform coefficient pixel located at the lower right end of the current block 600 to the transform coefficient pixel located at the upper left end of the current block 600 in a vertical scanning sequence 640, so as to scan information related to the transform coefficient of the current block 600.

[0480] Specifically, following the vertical scanning sequence 640, the video decoding device 100 scans the transform coefficient pixels 642 at the lower right end, then sequentially scans the pixels 644 located in the upper direction (vertical direction), and after scanning the pixels in the 644 adjacent to the upper boundary of the current block 600, scans the bottommost pixels 646 in the column immediately to its left. The video decoding device 100 scans the pixels 648 located in the upper direction (vertical direction) in the same manner as scanning the pixels 644 in the previous column. Similarly, following the vertical scanning sequence 640, the video decoding device 100 can scan information about the remaining transform coefficient pixels.

[0481] Figure 6e A schematic diagram is shown to illustrate a diagonal scanning sequence for scanning information related to transformation coefficients in a block, according to one embodiment.

[0482] refer to Figure 6e The video decoding device 100 can scan from the transform coefficient pixel located at the lower right end of the current block 600 to the transform coefficient pixel located at the upper left end of the current block 600 according to the diagonal scanning order 650, so as to scan information about the transform coefficients of the current block 600.

[0483] Specifically, according to the diagonal scanning sequence 650, the video decoding device 100 scans the pixel 654 located above pixel 652 after scanning the transform coefficient pixel 652 at the lower right end, and after scanning pixel 654, scans the pixel 656 located diagonally at the lower left end of it. The video decoding device 100 scans the pixel 658 located above pixel 654. The video decoding device 100 scans the pixel 660 located diagonally at the lower left end of pixel 658. In a similar manner, according to the diagonal scanning sequence 650, the video decoding device 100 can scan information related to the remaining transform coefficient pixels.

[0484] Reference Figures 6a to 6e Various scan sequences for scanning information related to the effective transform coefficients within a block have been described. (See reference...) Figures 6a to 6eThe described scanning order is not limited to the reverse scanning order, and those skilled in the art can easily understand the forward scanning order as the order of scanning that is the opposite of the reverse scanning order.

[0485] Figure 7a A schematic diagram is shown to illustrate the process of changing the scanning area by swapping the horizontal and vertical coordinates of the transformation coefficient pixels in the scanning area according to one embodiment.

[0486] refer to Figure 7a The current block 700 can be a rectangle with a width greater than its height.

[0487] The video decoding device 100 can obtain a flag indicating that an operation is activated that swaps the horizontal and vertical coordinates of the transform coefficient pixels included in the current block 700. When the flag indicates that an operation is activated that swaps the horizontal and vertical coordinates of the transform coefficient pixels included in the current block 700, the video decoding device 100 can determine whether the width of the current block 700 is greater than its height.

[0488] When the width of the current block is greater than its height, the video decoding device 100 can determine the swapped block 710 by swapping the width and height of the current block.

[0489] In other words, the video decoding device 100 can determine the pixel position of the transform coefficient included in the interchanged block 710 by interchanging the horizontal and vertical coordinates of the transform coefficient pixels included in the current block 700.

[0490] The video decoding device 100 can obtain information from the bitstream relating to the coordinates of a quadrilateral scan region 705 that specifies all valid transform coefficients. Here, the horizontal coordinates used to specify the coordinates of the quadrilateral scan region 705 can be the horizontal coordinates of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block. The vertical coordinates used to specify the coordinates of the quadrilateral scan region 705 can be the vertical coordinates of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block. The information relating to the coordinates of the quadrilateral scan region 705 can include information relating to the horizontal coordinates of the rightmost valid transform coefficient pixel among all valid transform coefficients in the current block and information relating to the vertical coordinates of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block. Alternatively, the information relating to the coordinates of the quadrilateral scan region 705 may include information relating to one of the horizontal coordinates of the rightmost valid transform coefficient pixel among all valid transform coefficients and the vertical coordinates of the bottommost valid transform coefficient pixel among all valid transform coefficients in the current block, and information indicating the difference between said coordinates.

[0491] When the width and height of the current block are different from each other, the video decoding device 100 can obtain flag information (hereinafter referred to as delta flag information) from the bitstream. This delta flag information indicates whether the information related to the coordinates of the quadrilateral scan region 705 includes information indicating the difference between the horizontal and vertical coordinate values ​​of the quadrilateral scan region 705. Based on the delta flag information, the video decoding device 100 can obtain from the bitstream information information indicating one of the horizontal and vertical coordinate values ​​of the quadrilateral scan region 705 and information indicating the difference between the two coordinate values.

[0492] The video decoding apparatus 100 can obtain the coordinates for specifying the quadrilateral scan region 705 based on information obtained from the bitstream related to the coordinates of the quadrilateral scan region 705, which includes all valid transform coefficients. At this time, the coordinates for specifying the quadrilateral scan region 705 obtained by the video decoding apparatus 100 are the coordinates for specifying the quadrilateral scan region 705 in the current block 700. By interchanging the horizontal and vertical coordinate values ​​for specifying the quadrilateral scan region 705, the video decoding apparatus 100 can obtain the coordinate values ​​for specifying the quadrilateral scan region 715 of the interposed block 710.

[0493] The video decoding device 100 can scan information related to transform coefficients according to a predetermined scanning order based on the quadrilateral scanning area 715 of the interchanged block 710. In this case, the predetermined scanning order can be a scanning order corresponding to a predetermined scanning order for the current block 700, and is a scanning order based on the coordinate values ​​of the transform coefficient pixels whose horizontal and vertical coordinate values ​​are interchanged according to the predetermined scanning order for the current block 700. For example, when the coordinate values ​​of the transform coefficient pixels scanned according to the predetermined scanning order for the current block 700 are (4,4)->(3,4)->(4,3)->..., the coordinate values ​​of the transform coefficient pixels scanned according to the predetermined scanning order for the interchanged block 710 can be (4,4)->(4,3)->(3,4)->...

[0494] The video decoding apparatus 100 can perform binary arithmetic decoding on information related to the transform coefficients scanned in the interchanged block 710 based on a predetermined context model, and can obtain the transform coefficients of the interchanged block 710 through debinarization. The video decoding apparatus 100 can obtain the transform coefficients of the current block 700 by interchanging the horizontal and vertical coordinate values ​​of the transform coefficients of the interchanged block 710.

[0495] When the width of the current block is greater than its height, the video decoding device 100 can perform entropy decoding on the information related to the scanned transform coefficients by swapping the horizontal and vertical coordinates of the transform coefficient pixels included in the current block and scanning the information related to the transform coefficients in the swapped block 710. This allows entropy decoding to always be performed on information related to the transform coefficients of blocks whose height is greater than or equal to the width of the current block. Therefore, instead of using a separate context model for the case where the width of the current block is greater than its height, the context model for blocks whose height is greater than or equal to the width of the current block can be used, reducing the complexity of entropy decoding.

[0496] The above description has described the content of the incremental flag information obtained by the video decoding device 100 when the width and height of the current block are different. However, it is not limited thereto. Those skilled in the art can easily understand that when the current block has different widths and heights, the video encoding device 150 and the video decoding device 100 can obtain information from the bitstream without obtaining the incremental flag information, which indicates the difference between the horizontal coordinate values ​​and the vertical coordinate values ​​of the transform coefficients used to specify the quadrilateral scan area 715.

[0497] However, it is not limited to this. Those skilled in the art will readily understand that the video decoding device 100, regardless of whether the width and height of the current block are the same or different, can obtain information indicating the difference between the horizontal and vertical coordinate values ​​of the transform coefficients without generating incremental flag information.

[0498] As described above, the video encoding device 150 generates a swap flag, and the video decoding device 100 determines whether to swap the horizontal and vertical coordinates of the transform coefficient pixels included in the current block based on the flag indicating that an operation is activated to swap the horizontal and vertical coordinates of the transform coefficient pixels included in the current block. However, it is not limited thereto, and those skilled in the art will readily understand that when the width of the current block is greater than its height, the video decoding device 100 can always swap the horizontal and vertical coordinates.

[0499] As described above, the video decoding device 100 swaps the horizontal and vertical coordinates of the transform coefficient pixels included in the current block when the width of the current block is greater than its height, and does not swap them otherwise. However, it is not limited to this, and those skilled in the art can easily understand that, conversely, when the height of the current block is greater than its width, the horizontal and vertical coordinates of the transform coefficient pixels included in the current block can be swapped.

[0500] The video decoding apparatus 100 has been described above as scanning information related to transform coefficients by swapping the horizontal and vertical coordinates of the transform coefficients of the current block and the horizontal and vertical coordinates of the transform coefficients of the scanning area, and performing entropy decoding on the scanned information related to transform coefficients to obtain the transform coefficients in the current block, and swapping the horizontal and vertical coordinates of the obtained transform coefficients. However, it is not limited to this. Those skilled in the art will readily understand that the video decoding apparatus 100 can obtain the transform coefficients in the scanning area by swapping only the horizontal and vertical coordinates of the transform coefficients of the scanning area and performing scanning and entropy decoding on the information related to the transform coefficients in the scanning area without swapping the horizontal and vertical coordinates of the current block, and by swapping the horizontal and vertical coordinates of the transform coefficients in the scanning area to obtain the transform coefficients in the current block.

[0501] The video decoding apparatus 100 has been described above as scanning information related to transform coefficients by swapping the horizontal and vertical coordinates of the transform coefficients of the current block and the horizontal and vertical coordinates of the transform coefficients of the scanning area, and performing entropy decoding on the scanned information related to transform coefficients to obtain the transform coefficients in the current block, and swapping the horizontal and vertical coordinates of the obtained transform coefficients. However, it is not limited to this. Those skilled in the art will readily understand that it is possible to swap the horizontal and vertical coordinates of the transform coefficients of the scanning area and perform decoding on them without swapping the horizontal and vertical coordinates of the transform coefficients, and obtain the transform coefficients in the scanning area and the transform coefficients in the current block by performing scanning and entropy decoding on the transform coefficient information in the scanning area.

[0502] In other words, when the width of the current block is greater than its height, the video encoding device 150 can interchange the horizontal and vertical coordinates of the transform coefficients of the scanned area of ​​the current block and send the information indicating this interchange. At this time, since the width of the scanned area is usually greater than its height when the width of the current block is greater than its height, the horizontal coordinates of the transform coefficients specifying the scanned area are greater than their vertical coordinates. Furthermore, when the coordinates are interchanged, the vertical coordinates of the interchanged transform coefficients are less than their horizontal coordinates. Therefore, the number of bits can be reduced by sending information related to the horizontal coordinate values ​​of the interchanged transform coefficients and the difference information between the horizontal and vertical coordinate values ​​of the interchanged transform coefficients. However, when the width of the current block is greater than its height, and the height of the scanned area is greater than its width, the video encoding device 150 can send the horizontal coordinate values ​​of the interchanged transform coefficients and the information about the interchanged horizontal and vertical coordinate values ​​as is. That is, the difference information may not be sent. This is because the horizontal coordinate values ​​of the interchanged transform coefficients are greater than their vertical coordinate values.

[0503] The video encoding device 150 can simultaneously send a flag indicating whether to send difference information. When the width of the current block is greater than its height, the video decoding device 100 can determine to swap the horizontal and vertical coordinate values ​​of the transform coefficients of the specified scan area, obtain a flag from the bitstream, and when the flag value is 1 (indicating the transmission of difference information), obtain information related to the horizontal coordinate values ​​of the swapped transform coefficients and the difference information related to the horizontal and vertical coordinate values ​​of the swapped transform coefficients, and obtain the coordinate values ​​of the specified swapped scan area based on the difference information.

[0504] When the value of the flag is 0 (indicating that no difference information is sent), information related to the horizontal coordinate values ​​of the interchanged transform coefficients and the vertical coordinate values ​​of the interchanged transform coefficients can be obtained, and the coordinate values ​​of the specified interchanged scan area can be obtained based on the obtained information.

[0505] The video decoding device 100 can specify the final scanning area and scan information about the transform coefficients in the scanning area by interchanging the horizontal and vertical coordinate values ​​of the obtained transform coefficients.

[0506] However, this is not limited to the case where the width of the current block is greater than its height, and even when the height of the current block is greater than its width, those skilled in the art will readily understand that a similar operation can be performed.

[0507] Figure 7b A schematic diagram is shown to illustrate the process of changing the scanning area by swapping the horizontal and vertical coordinates of the transformation coefficient pixels in the quadrilateral scanning area according to another embodiment.

[0508] refer to Figure 7b The current block 720 can be a rectangle with a width greater than its height.

[0509] The video decoding device 100 can obtain a flag indicating that an operation is activated that swaps the horizontal and vertical coordinates of the transform coefficient pixels included in the current block 720. When the flag indicates that an operation is activated that swaps the horizontal and vertical coordinates of the transform coefficient pixels included in the current block 720, the video decoding device 100 can determine whether the width of the current block 720 is greater than its height.

[0510] When the width of the current block is greater than its height, the video decoding device 100 can determine the swapped block 730 by swapping the width and height of the current block.

[0511] In other words, the video decoding device 100 can determine the pixel position of the transform coefficient included in the swapped block 730 by swapping the horizontal and vertical coordinates of the transform coefficient pixels included in the current block 720.

[0512] The video decoding apparatus 100 can obtain information from the bitstream relating to the coordinates of a scan region 725 that includes all valid transform coefficients. Here, the coordinates for specifying the scan region 725 can be the horizontal and vertical coordinates of the last valid transform coefficient pixel scanned in a predetermined forward scanning order. The information relating to the coordinates of the scan region 725 can include information relating to the horizontal coordinates of the last valid transform coefficient pixel 725 and information relating to the vertical coordinates. Alternatively, the information relating to the coordinates of the scan region 725 can include information relating to one of the horizontal and vertical coordinates of the last valid transform coefficient pixel, and information indicating the difference between the other coordinate value.

[0513] When the width and height of the current block are different from each other, the video decoding device 100 can obtain flag information (hereinafter referred to as incremental flag information) from the bitstream. This flag information indicates whether the information regarding the coordinates of the specified scan area 725 includes information indicating the difference between the horizontal and vertical coordinate values ​​of the specified scan area 725. The video decoding device 100 can obtain information from the bitstream based on the incremental flag information indicating one of the horizontal and vertical coordinate values ​​of the transform coefficients used to specify the scan area 725, and information indicating the difference between the two coordinate values.

[0514] The video decoding apparatus 100 can obtain the coordinates for specifying the scan region 725 based on information obtained from the bitstream related to the coordinates of the scan region 725, which includes all valid transform coefficients. At this time, the coordinates of the transform coefficients for specifying the scan region 725 obtained by the video decoding apparatus 100 are the coordinates for specifying the scan region 725 in the current block 720. By interchanging the horizontal and vertical coordinate values ​​for specifying the scan region 725, the video decoding apparatus 100 can obtain the coordinate values ​​for specifying the transform coefficients of the scan region 725 of the interchanged block 730.

[0515] The video decoding device 100 can scan information related to transform coefficients according to a predetermined scanning order based on the scanning area 735 of the interchanged block 730. In this case, the predetermined scanning order can be a scanning order in which the horizontal and vertical coordinate values ​​of the transform coefficient pixels scanned according to a scanning order corresponding to the predetermined scanning order for the current block 720 are interchanged. For example, when the coordinate values ​​of the transform coefficient pixels scanned according to the predetermined scanning order for the current block 720 are (4,4)->(3,4)->(4,3)->…, the coordinate values ​​of the transform coefficient pixels scanned according to the predetermined scanning order of the interchanged block 730 can be (4,4)->(4,3)->(3,4)->….

[0516] The video decoding apparatus 100 can obtain the transform coefficients of the interchanged block 730 by performing binary arithmetic decoding and debinarization on information related to the transform coefficients scanned in the interchanged block 730 based on a predetermined context model. The video decoding apparatus 100 can obtain the transform coefficients of the current block 720 by interchanging the horizontal and vertical coordinate values ​​of the transform coefficients of the interchanged block 730.

[0517] When the width of the current block is greater than its height, the video decoding device 100 can perform entropy decoding on the information related to the scanned transform coefficients by swapping the horizontal and vertical coordinates of the transform coefficient pixels included in the current block and scanning the information related to the transform coefficients in the swapped block 710. This ensures that entropy decoding is always performed on information related to transform coefficients of blocks whose height is greater than or equal to the width of the current block. Therefore, the complexity of entropy decoding can be reduced by using only the context model for blocks whose height is greater than or equal to the width of the current block, instead of using a separate context model for the case where the width of the current block is greater than its height.

[0518] The above description has described the content of the incremental flag information obtained by the video decoding device 100 when the width and height of the current block 700 are different. However, it is not limited thereto. Those skilled in the art can easily understand that when the current block has different widths and heights, the video encoding device 150 and the video decoding device 100 can obtain information from the bitstream indicating the difference between the horizontal and vertical coordinate values ​​of the transform coefficients used to specify the scan area 720 without obtaining the incremental flag information.

[0519] However, not limited thereto, those skilled in the art can readily understand that the video decoding device 100 can obtain information indicating the difference between the horizontal and vertical coordinate values ​​of the transform coefficients without generating incremental flag information, regardless of whether the width and height of the current block 700 are the same or different.

[0520] As described above, the video encoding device 150 generates a swap flag, and the video decoding device 150 determines whether to swap the horizontal and vertical coordinates of the transform coefficient pixels included in the current block based on the flag indicating that an operation is activated to swap the horizontal and vertical coordinates of the transform coefficient pixels included in the current block. However, it is not limited thereto, and those skilled in the art will readily understand that when the width of the current block is greater than its height, the video decoding device 100 can always swap the horizontal and vertical coordinates of the transform coefficients.

[0521] As described above, when the width of the current block is greater than its height, the video decoding device 100 swaps the horizontal and vertical coordinates of the transform coefficient pixels included in the current block; otherwise, it does not swap them. However, it is not limited to this, and those skilled in the art can easily understand that, conversely, when the height of the current block is greater than its width, the horizontal and vertical coordinates of the transform coefficient pixels included in the current block can be swapped.

[0522] The video decoding apparatus 100 has been described above as scanning information related to transform coefficients by swapping the horizontal and vertical coordinates of the transform coefficients of the current block and the horizontal and vertical coordinates of the transform coefficients of the scanning area, and performing entropy decoding on the scanned information related to transform coefficients to obtain the transform coefficients in the current block, and swapping the horizontal and vertical coordinates of the obtained transform coefficients. However, it is not limited to this. Those skilled in the art will readily understand that the video decoding apparatus 100 can obtain the transform coefficients in the scanning area by swapping only the horizontal and vertical coordinates of the transform coefficients of the scanning area and performing scanning and entropy decoding on the information related to the transform coefficients in the scanning area without swapping the horizontal and vertical coordinates of the current block, and by swapping the horizontal and vertical coordinates of the transform coefficients in the scanning area.

[0523] The video decoding apparatus 100 has been described above as scanning information related to transform coefficients by swapping the horizontal and vertical coordinates of the transform coefficients of the current block and the horizontal and vertical coordinates of the transform coefficients of the scanned area, and performing entropy decoding on the scanned information related to transform coefficients to obtain the transform coefficients in the current block, and swapping the horizontal and vertical coordinates of the obtained transform coefficients. However, it is not limited to this. Those skilled in the art will readily understand that the video decoding apparatus 100 may, without swapping the horizontal and vertical coordinates of the transform coefficients, only swap the horizontal and vertical coordinates of the transform coefficients of the scanned area and perform decoding on them, and obtain the transform coefficients in the scanned area by performing scanning and entropy decoding on the information related to the transform coefficients in the scanned area, and obtain the transform coefficients in the current block.

[0524] In other words, when the width of the current block is greater than its height, the video encoding device 150 can interchange the horizontal and vertical coordinates of the transform coefficients of the current block's scan area and send the information indicating this interchange. Typically, when the width of the current block is greater than its height, the width of the scan area is greater than its height, and the horizontal coordinates of the transform coefficients specifying the scan area are greater than their vertical coordinates. Furthermore, when the coordinates are interchanged, the vertical coordinates of the interchanged transform coefficients are less than their horizontal coordinates. Therefore, the number of bits can be reduced by sending information related to the interchanged horizontal coordinate values ​​and the difference information related to the interchanged horizontal and vertical coordinate values. However, when the width of the current block is greater than its height, and the height of the scan area is greater than its width, the video encoding device 150 can send the horizontal coordinate values ​​of the interchanged transform coefficients as is, along with the horizontal and vertical coordinate values ​​of the interchanged transform coefficients. That is, the difference information may not be sent. This is because the horizontal coordinate values ​​of the interchanged transform coefficients are greater than their vertical coordinate values.

[0525] The video encoding device 150 can simultaneously send a flag indicating whether to send difference information. When the width of the current block is greater than its height, the video decoding device 100 can determine that the horizontal and vertical coordinate values ​​of the transform coefficients of the specified scanning area are interchanged, and obtain a flag from the bitstream. When the value of the flag is 1 (indicating the transmission of difference information), it can obtain information related to the horizontal coordinate values ​​of the interchanged transform coefficients and difference information related to the difference between the horizontal and vertical coordinate values ​​of the interchanged transform coefficients. Based on the difference information, it can obtain the coordinate values ​​of the specified interchanged scanning area.

[0526] When the value of the flag is 0 (indicating that no difference information is sent), the video decoding device 100 can obtain information related to the horizontal coordinate values ​​of the interchanged transform coefficients and information related to the vertical coordinate values ​​of the interchanged transform coefficients, and obtain the coordinate values ​​of the specified interchanged scan area based on the obtained information.

[0527] The video decoding device 100 can specify the final scanning area and scan information related to the transform coefficients in the scanning area by interchanging the horizontal and vertical coordinate values ​​of the obtained transform coefficients.

[0528] However, this is not limited to the case where the width of the current block is greater than its height, and even when the height of the current block is greater than its width, those skilled in the art will readily understand that a similar operation can be performed.

[0529] Figure 8 A schematic diagram is shown illustrating a process for determining a context model related to syntactic element information of transform coefficients in the current block based on at least one of the size and shape of the current block, according to an embodiment.

[0530] refer to Figure 8 The current block can have one of the shapes of the first block 805, the second block 810, and the third block 815. The first block can be a rectangular block with a height greater than its width, the second block 815 can be a rectangular block with a width greater than its height, and the third block 815 can be a square block with the same width and height.

[0531] The video decoding device 100 can determine a context model related to the syntax element information of the transform coefficients in the current block based on size_tu0 determined according to Equation 19.

[0532] Equation 19

[0533]

[0534] Here, `log2_width` can be the width of the current block, taken as log2, and `log2_height` can be the height of the current block, taken as log2. (See reference.) Figure 8 When the current block is the first block (805), size_tu can be (log2a + log2b) / 2 (where a and b are positive integers). When the current block is the second block (810), size_tu can be (log2c + log2b) / 2. -2 d) / 2 (c and d are positive integers). When the current block is the third block 815, size_tu can be log2e (e is a positive integer).

[0535] Alternatively, the video decoding device 100 may determine a value related to the size of the current block, which is an element of the context model, based on the minimum of the width and height of the current block. For example, the video decoding device may determine the value size_tu1 related to the size of the current block, which is an element of the context model, based on the following equation 20.

[0536] Equation 20

[0537]

[0538] Here, the Min() function can be a function that outputs the minimum value among the input values. (See reference) Figure 8 When the current block is the first block 805, size_tu1 can be log2a (a is a positive integer). When the current block is the second block 810, size_tu1 can be log-2d (d is a positive integer). When the current block is the third block 815, size_tu1 can be log2e (e is a positive integer).

[0539] The video decoding device 100 can determine a context model related to the syntax element information of the transform coefficients in the current block based on size_tu1 determined according to Equation 20.

[0540] Alternatively, the video decoding device 100 may determine a value related to the size of the current block as an element of the context model based on the maximum value between the width and height of the current block. For example, the video decoding device 100 may determine the value size_tu2 related to the size of the current block as an element of the context model based on the following equation 21.

[0541] Equation 21

[0542]

[0543] Here, the Max() function can be a function that outputs the maximum value among the input values ​​of a function.

[0544] The video decoding device 100 can determine a context model related to the syntax element information of the transform coefficients in the current block based on size_tu2 determined according to [Equation 21].

[0545] If a is 4, b is 16 and e is 8, then size_tu related to the first block 805 and size_tu0 related to the third block 815 can be equal to 3.

[0546] Even if the transform coefficients tend to be distributed on the larger side of the height and width of the current block, the video decoding device 100 can determine the same context model for the first block 805 and the third block 815 based on size_tu0. However, when the video decoding device 100 determines the context model for the first block 805 and the third block 815 based on size_tu1 or size_tu2, the context model can be different, thus improving the efficiency of binary arithmetic decoding compared to determining the context model based on size_tu0.

[0547] The video decoding device 100 can determine values ​​related to the size of the current block as elements of the determination context model based on the shape of the current block. For example, the video decoding device 100 can determine the value shape_tu, which is related to the shape of the current block and serves as an element of the determination context model, based on the following equation 22.

[0548] Equation 22

[0549]

[0550] For example, when the current block is the first block (805), `shape_tu` can be 1; when the current block is the second block (810), `shape_tu` can be 2; and when the current block is the third block (815), `shape_tu` can be 0. In other words, when the current block's shape is a rectangle whose width is greater than its height, `size_tu` can be 2; when the current block's shape is a rectangle whose height is greater than its width, `size_tu` can be 1; and when the current block's shape is a square whose width and height are the same, `size_tu` can be 0.

[0551] In [Equation 22], the height and width of the current block are used, but this is not the only one. Those skilled in the art will readily understand that it can be determined based on log2_width and log2_height as in [Equation 21]. Furthermore, in [Equation 22], shape_tu is determined to be a value between 0 and 2, but this is not the only one. Those skilled in the art will readily understand that shape_tu can be assigned other values, and the shape of the current block indicated by each value can also be changed.

[0552] If a is 4, b is 16 and e is 8, then the size_tu related to the first block 805 can be 3, and the size_tu related to the third block 815 can be equal to 3.

[0553] Even if the transform coefficients tend to be distributed on the larger side of the height and width of the current block, the video decoding device 100 can determine the same context model for the first block and the third block based on size_tu0. However, when the video decoding device 100 determines the context model for the first block 805 and the third block 815 based on shape_tu, the context model can be different, thus improving the efficiency of binary arithmetic decoding compared to determining the context model based on size_tu0.

[0554] Furthermore, the video decoding device 100 can determine a context model related to the transform coefficients based on the ratio between the minimum and maximum values ​​of the current block, said ratio being calculated based on the minimum value size_tu1 and the maximum value size_tu2 of the current block's height and width. For example, when the ratio between the minimum and maximum values ​​is within a predetermined range, the video decoding device 100 can determine a context index corresponding to that range and determine a context model related to the transform coefficients based on the determined context index. For example, when the height of the current block is greater than its width and the value of the ratio between the minimum (width) and maximum (height) is in the range of 1 to 2, a context index corresponding to that range can be determined, and when the value of the ratio between the minimum and maximum values ​​is in the range of 2 or greater, a context index corresponding to that value can be determined.

[0555] Furthermore, the video decoding device 100 can determine a context model related to the transform coefficients based on the shape and size of the current block. That is, the video decoding device 100 can determine a context model related to the transform coefficients based on the size and shape of the current block.

[0556] The video decoding device 100 can determine a context index related to the transform coefficients based on at least one of the values ​​size_tu1 and size_tu2 related to the size of the current block and a value shape_tu related to the shape of the current block, and can determine a context model corresponding to the determined context index.

[0557] Figures 9a to 9c A schematic diagram illustrating the residual coding syntax structure according to one embodiment is shown.

[0558] refer to Figures 9a to 9c The video decoding device 100 can scan syntax element information related to the transform coefficients and perform decoding on the transform coefficients based on the scanned syntax element information to recover the transform coefficients.

[0559] First, the video decoding device 100 can obtain the syntax element information scan_region_x and scan_region_y from the bitstream. The syntax element information scan_region_x and scan_region_y indicate the coordinates used to specify the quadrilateral scan region. At this time, the syntax element information scan_region_x can indicate the horizontal (x-axis) coordinate of the rightmost valid transform coefficient in the current block, based on the coordinates of the upper left corner of the current block, and the syntax element information scan_region_y can indicate the vertical (y-axis) coordinate of the bottommost valid transform coefficient in the current block, based on the coordinates of the upper left corner of the current block. The video decoding device 100 can then determine the coordinates srX and srY used to specify the scan region based on the syntax element information scan_region_x and scan_region_y.

[0560] The video decoding device 100 can determine the scanning order ScanOrder(srX+1, srY+1) based on the coordinates srX and srY used to specify the scanning area.

[0561] The video decoding device 100 can determine the index information lastSet, which indicates the last coefficient group scanned in the forward scanning order, based on the coordinates srX and srY used to specify the scanning area. In other words, the video decoding device 100 can determine the index information lastSet of the last scanned coefficient group by performing a right-shifting operation (>>4) on the value of (srX+1)×(srY+1), which is the size value of the scanning area, minus 1. That is, the output value of the right-shifting operation can be the same as the quotient determined by the division by 16. In other words, since the video decoding device 100 determines that every 16 transform coefficients constitute a coefficient group, the total number of coefficient groups can be determined by dividing the total number of transform coefficients to be scanned in the scanning area by 16 (or by adding 1 to the index value of the coefficient group that is last scanned in the forward scanning order).

[0562] The video decoding device 100 can determine the position lastScanPos of the last coefficient scanned in the forward scanning sequence based on the coordinates srX and srY used to specify the scanning area, and determine the position Pos of the current transform coefficient as the position lastScanPos of the last coefficient scanned in the forward scanning sequence.

[0563] The video decoding device 100 can initialize i to lastset, decrement i by 1 when i is greater than 0, and execute the operation included in the loop statement (for statement) 905. The video decoding device 100 can execute the operation included in the loop statement (for statement) 905 until it becomes a value less than 0. At this time, i can be an index indicating the coefficient group. In other words, whenever the operation included in the loop statement (for statement) 905 is executed, the video decoding device 100 can perform the operation for a coefficient group.

[0564] The video decoding device 100 can determine setPos by performing an operation of multiplying i by 16 (i<<4). setPos can indicate the index information of the transform coefficient located at the first of the transform groups.

[0565] The video decoding device 100 can determine n as the value of lastScanPos minus setPos (lastScanPos - setPos) when i is the last coefficient set (i == lastSet); otherwise, n is determined to be 15. When n is greater than or equal to 0, i can be decreased by 1, and the operation included in the loop statement (for statement) 910 can be executed. The video decoding device 100 can execute the operation included in the loop statement (for statement) 910 (the operation related to sig_flag) until it becomes a value less than 0. At this time, n can be index information indicating the position of the transform coefficients in the coefficient set in the forward scanning order.

[0566] For example, when the total number of transformation coefficients included in the scan region is not an integer multiple of 16, the value of subtracting setPos from lastScanPos, which is related to the last set of coefficients scanned in the forward scanning order (i=lastset), can be greater than or equal to 0 and less than or equal to 15, and this value can be determined as n, and the operation of the loop statement (for statement) 910 can be performed.

[0567] The video decoding device 100 can determine the position blkpos of the current transform coefficient as a value obtained by adding the index information setPos, which indicates the position of the first coefficient in the current coefficient group in the ScanOrder arrangement, to n. The ScanOrder arrangement can be an arrangement representing the positions of the transform coefficients in the forward scanning order.

[0568] The video decoding device 100 can determine the value of the coordinate sx in the horizontal direction (x-axis direction) of the currently scanned component based on the position blkpos of the current transform coefficient and the width of the scanning area. Furthermore, the video decoding device 100 can determine the value of the coordinate sy in the vertical direction (y-axis direction) based on the position blkpos of the currently decoded transform coefficient and the width log2width of the scanning area.

[0569] When sx is 0, sy is srY, and is_last_y is 0 (sx==0&&sy==srY&&is_last_y==0), or when sy is 0, sx is srX, and is_last_x is 0 (sy==0&&sx==srX&&is_last_x==0), the video decoding device 100 can obtain the valid transform coefficient flag sig_flag (sig_flag[blkpos]) related to the current transform coefficient from the bitstream, and instead determine the value of sig_flag related to the current transform coefficient to be 1. Here, is_last_x may be a value indicating whether there is a valid transform coefficient with an absolute value greater than 0 among the transform coefficients scanned before the current transform coefficient in the bottom row of the scanned area. is_last_y may be a value indicating whether there is a valid transform coefficient with an absolute value greater than 0 among the transform coefficients scanned before the current transform coefficient in the rightmost column of the scanned area.

[0570] When sx is 0, sy is srY, and is_last_y is 0 (sx==0&&sy==srY&&is_last_y==0), or when sy is 0, sx is srX, and is_last_x is 0 (sy==0&&sx==srX&&is_last_x==0), the video decoding device 100 can obtain the valid transform coefficient flag sig_flag[blkpos] related to the currently decoded transform coefficients from the bitstream.

[0571] The video decoding device 100 can set is_last_x to 1 when the valid transform coefficient flag sig_flag of the current transform coefficient is 1 and the coordinate value sx in the x-axis direction of the current transform coefficient is equal to srX (sx==srX), ​​and set is_last_y to 1 when the coordinate value sy in the y-axis direction of the current transform coefficient is equal to srY (sy==srY).

[0572] Furthermore, when lastSigScanPos is -1 (i.e., the initial value), the video decoding device 100 can determine lastSigScanPos as n. In other words, since the index n of the position of the first valid transform coefficient in the reverse scanning order of the coefficient group is determined as lastSigScanPos, lastSigScanPos can be the position of the last valid transform coefficient in the forward scanning order of the coefficient group. Additionally, the video decoding device 1000 can determine firstSigScanPos as n. When the valid transform coefficient flag sig_flag of the current transform coefficient is 1, since the value of firstSigScanPos is continuously updated to n, which serves as the index information indicating the position of the current transform coefficient, when finally operating on the transform coefficients included in a specific coefficient group i, firstSigScanPos can be the index information indicating the position of the first valid transform coefficient in the reverse scanning order of the coefficient group.

[0573] The video decoding device 100 increments cnt_nz by 1. In other words, cnt_nz, which indicates the number of coefficients with non-zero values ​​in the current block (or scan area), is updated whenever the current transform coefficient is a valid transform coefficient. Furthermore, the video decoding device 100 increments cg_nz[i], which indicates the number of coefficients with non-zero values ​​in the current coefficient group i, by 1. In other words, cg_nz[i], which indicates the number of coefficients with non-zero values ​​in the current coefficient group i, is updated whenever the current transform coefficient is a valid transform coefficient.

[0574] The video decoding device 100 can determine n as the value of lastScanPos minus setPos (lastScanPos - setPos) when i is the last set of coefficients (i == lastSet); otherwise, it can determine n as 15. When n is greater than or equal to 0, it can decrease i by 1 and execute the operations included in the loop statement (for statement) 915. The video decoding device 100 can execute the operations included in the loop statement (for statement) 915 (operations related to coeff_abs_level_greater1_flag and coeff_abs_level_greater2_flag) until the value becomes less than 0.

[0575] The video decoding device 100 can determine the position blkpos of the current transform coefficient as a value obtained by adding the index information (setPos) indicating the position of the first coefficient in the ScanOrder arrangement of the current coefficient group to n.

[0576] The video decoding device 100 can obtain the absolute value abs_coef related to the current transform coefficients based on the information gt0 flag, gt1 flag, gt2 flag and remaining_abolute value level related to the current transform coefficients.

[0577] When the valid transform coefficient flag sig_flag [blkpos] of the transform coefficient is 1, the video decoding device 100 can obtain coeff_abs_level_greater1_flag [blkpos] related to the current transform coefficient from the bitstream when the sum of cnt_gl (i.e., the number of transform coefficients in the previously scanned coefficient group whose absolute value is greater than 1) and c1 (i.e., the number of transform coefficients in the current coefficient group whose absolute value is greater than 1 and whose coeff_abs_level_greater1_flag can be obtained from the bitstream) is less than num_gtl (i.e., the maximum number of transform coefficients whose absolute value is greater than 1 and whose coeff_abs_level_greater1_flag can be obtained from the bitstream). coeff_abs_level_greater1_flag can be a flag indicating whether the absolute value of the current transform coefficient is greater than 1. The video decoding device 100 can determine the flag gt1_flag (gt1flag[blkpos]) of the current transform coefficients based on coeff_abs_level_greater1_flag obtained from the bitstream.

[0578] When the value of the flag gt1_flag of the current transform coefficient is 1, the video decoding device 100 can increment c1 by 1. When the flag gt1_flag of the current transform coefficient is 1, the value of c1 is updated because the value of c1 is incremented by 1. Therefore, when performing a loop statement (for statement) operation on the next transform coefficient, c1 can indicate the number of transform coefficients whose coeff_abs_level_greater1_flag is obtained from the bitstream among the previously scanned transform coefficients in the current coefficient group.

[0579] When the valid transform coefficient flag sig_flag[blkpos] of the current transform coefficient is 1, if the sum of cnt_g2 (i.e., the number of transform coefficients in the previously scanned coefficient group whose absolute value is greater than 2) and c2 (i.e., the number of transform coefficients in the current coefficient group whose coeff_abs_level_greater2_flag was obtained from the bitstream from the previously scanned group) is less than num_gt2 (i.e., the maximum number of transform coefficients in the current coefficient group whose absolute value is greater than 2 and whose coeff_abs_level_greater2_flag can be obtained from the bitstream), the video decoding device 100 can obtain the coeff_abs_level_greater2_flag related to the current transform coefficient from the bitstream. coeff_abs_level_greater2_flag can be a flag indicating whether the absolute value of the current transform coefficient is greater than 2. The video decoding device 100 can determine the flag gt2_flag of the current transform coefficient based on the coeff_abs_level_greater2_flag obtained from the bitstream.

[0580] When the value of the flag gt2_flag of the current transform coefficient is 1, the video decoding device 100 can increment the current gt2flag count c2 by 1. When the flag gt2_flag of the current transform coefficient is 1, the value of c2 is updated because the value of c2 is incremented by 1. Therefore, when performing a loop statement (for statement) operation for the next transform coefficient, c2 can indicate the number of transform coefficients in the current coefficient group that have obtained coeff_abs_level_greater1_flag from the bitstream among the previously scanned transform coefficients.

[0581] In addition, the video decoding device 100 can set escapeDataPresent to 1. escapeDataPresent can be an indication that there is information that needs to be acquired to determine the values ​​of the transform coefficients in the current transform group (e.g., the residual level absolute value information coeff_abs_level_remaining).

[0582] When the flag sig_flag[blkpos] of the valid transform coefficients of the current transform coefficient is 1, the video decoding device 100 may determine escapeDataPresent as 1 if the sum of cnt_g2 (i.e., the number of transform coefficients in the previously scanned coefficient group whose absolute value is greater than 2) and c2 (i.e., the number of transform coefficients in the current coefficient group whose coeff_abs_level_greater2_flag was obtained from the bitstream from the previously scanned coefficients) is not less than num_gt2 (i.e., the maximum number of transform coefficients in the current coefficient group whose absolute value is greater than 2 whose coeff_abs_level_greater_flag can be obtained from the bitstream).

[0583] When the sum of cnt_g1 (i.e., the number of transform coefficients in the previously scanned coefficient group whose absolute value is greater than 1) and c1 (i.e., the number of transform coefficients in the current coefficient group whose absolute value is greater than 1 and whose coeff_abs_level_greater1_flag is obtained from the bitstream) is not less than num_gt1 (i.e., the maximum number of transform coefficients in the current coefficient group whose absolute value is greater than 1 and whose coeff_abs_level_greater_flag is obtainable from the bitstream), the video decoding device 100 can determine escapeDataPresent as 1.

[0584] When escapeDataPresent is 1, and i indicates the last coefficient group (i == lastSet), the video decoding device 100 can determine n as the value of lastScanPos minus setPos (lastScanPos - setPos); otherwise, n is determined to be 15. When n is greater than or equal to 0, i can be decremented by 1, and the operation included in the loop statement (for statement) 920 can be executed. The video decoding device 100 can execute the operation included in the loop statement (for statement) 920 (the operation related to coeff_abs_level_reamining) until it becomes a value less than 0.

[0585] The video decoding device 100 can determine the position blkpos of the current transform coefficient by adding the index information (setPos) indicating the position of the first coefficient in the ScanOrder arrangement of the current coefficient group to n.

[0586] When the absolute value of the current transform coefficient is greater than 1 (sig_flag[blkpos]), the video decoding device 100 can determine the base level. When cnt_gt1 (i.e., the number of transform coefficients in the current coefficient group whose absolute value is greater than 1 among the transform coefficients scanned before the current transform coefficient) is less than num_gt1 (i.e., the maximum number of transform coefficients whose absolute value is greater than 2 and whose coeff_abs_level_greater_flag can be obtained from the bitstream), and when cnt_gt2 (i.e., the number of transform coefficients in the current coefficient group whose absolute value is greater than 2 among the transform coefficients scanned before the current transform coefficient) is less than num_gt2 (i.e., the maximum number of transform coefficients whose absolute value is greater than 2 and whose coeff_abs_level_greater_flag can be obtained from the bitstream), the video decoding device 100 can determine the base level as 3. When cnt_gt1 is less than num_gt1 which can be obtained from the bitstream, and cnt_gt2 is less than num_gt2, the video decoding device 100 can determine the basic level as 2. When cnt_gt1 is not less than num_gt1, the video decoding device 100 can determine the basic level as 1.

[0587] The video decoding device 100 can determine the absolute value level abs_coef of the current transform coefficient as the value of gtlflag plus the value of gt2flag plus 1 for the current transform coefficient. When the absolute value of the current transform coefficient has the same value as the base level (abs_coef[blkpos] == base_level), the video decoding device 100 can obtain the residual absolute value level coeff_abs_level_remaining related to the current transform coefficient from the bitstream. The video decoding device 100 can determine the absolute value level abs_coef related to the current transform coefficient by adding the residual absolute value level coeff_abs_level_remaining related to the current transform coefficient to abs_coef.

[0588] When the absolute value level abs_coef related to the current transform coefficient is greater than 2, the video decoding device 100 may increment cnt_gt2 by 1. Furthermore, when the absolute value level abs_coef related to the current transform coefficient is greater than 1, the video decoding device 100 may increment cnt_gt1 by 1.

[0589] When escapeDataPresent is 0, if i indicates the last coefficient group (i == lastSet), n can be determined as the value of lastScanPos minus setPos (lastScanPos - setPos); otherwise, n is determined as 15, and when n is greater than or equal to 0, i is decremented by 1, and the operation included in the loop statement (for statement) 925 is executed. The video decoding device 100 can execute the operation included in the loop statement (for statement) 925 (the operation related to abs_coef). The value can be determined as the index information setPos indicating the position of the first coefficient of the current coefficient group in the ScanOrder arrangement plus the value of n.

[0590] When the flag for the valid transform coefficient of the current transform coefficient is 1, and if abs_coef, the absolute value associated with the current transform coefficient, is greater than or equal to 2, the video decoding device 100 may increment cnt_gt2 by 1. When the flag for the valid transform coefficient associated with the current transform coefficient is 1, and if abs_coef, the absolute value associated with the current transform coefficient, is greater than or equal to 1, the video decoding device 100 may increment cnt_gt1 by 1.

[0591] When the difference between the position of the last valid transform coefficient (lastSigScanPos) and the position of the first valid transform coefficient (firstSigScanPos) in coefficient group i scanned in the forward scanning order is greater than 3, the video decoding device 100 can determine the value of signHidden[i] as 1, where signHidden indicates that at least one symbol is hidden in the current coefficient group i. When the difference between the position of the last valid transform coefficient (lastSigScanPos) and the position of the first valid transform coefficient (firstSigScanPos) in the current coefficient group scanned in the forward scanning order is not greater than 3, the video decoding device 100 can determine the value of signHidden[i] as 0, where signHidden indicates that at least one symbol is hidden in the current coefficient group i.

[0592] The video decoding device 100 can initialize i to 0, and increment i by 1 when i is less than or equal to lastSet, and execute the operation included in the loop statement (for statement) 930. The video decoding device 100 can execute the operation included in the loop statement (for statement) 930 until i becomes a value greater than lateSet. At this time, i can be an index indicating a coefficient group. In other words, each time the operation included in the loop statement (for statement) 930 is executed, the video decoding device 100 can perform an operation for a coefficient group.

[0593] When applying rsp (residual sign prediction) (rsp_apply), if i is the last set of coefficients (i==lastSet), the video decoding device 100 can determine n as the value of lastScanPos minus setPos (lastScanPos-setPos); otherwise, n is determined to be 15, and if n is greater than or equal to 0, i is decreased by 1, and the operation included in the loop statement (for statement) 935 is executed. The video decoding device 100 can execute the operation included in the loop statement (for statement) 935 until it becomes a value less than 0.

[0594] The video decoding device 100 can determine the position blkpos of the currently decoded transform coefficient as the index information setPos, which indicates the position of the first coefficient of the current coefficient group in the ScanOrder arrangement according to the forward scanning order, plus the current value of n.

[0595] When the position blkpos of the currently decoded transform coefficient is not rsp_pos, and the sign of the transform coefficient is the position hidden_pos of the hidden transform coefficient, the video decoding device 100 can determine the information sign[blkpos] related to the sign of the currently decoded transform coefficient as the information hidden_sign related to the sign of the hidden transform coefficient.

[0596] When the sign of the transform coefficient is not the hidden_pos position of the hidden transform coefficient, the video decoding device 100 can obtain information sign[blkpos] related to the sign of the currently decoded transform coefficient from the bitstream.

[0597] When the position blkpos of the currently decoded transform coefficient is rsp_pos, the video decoding device 100 can obtain information sign_rsp[blkpos] related to the rsp symbol of the currently decoded transform coefficient from the bitstream.

[0598] When rsp is not applied, if i is the last set of coefficients (i == lastSet), the video decoding device 100 can determine n as the value of lastScanPos minus setPos (lastScanPos - setPos); otherwise, n is determined to be 15, and when n is greater than or equal to 0, i is decremented by 1, and the operation included in the loop statement (for statement) 940 is executed. The video decoding device 100 can execute the operation included in the loop statement (for statement) 940 until it becomes a value less than 0.

[0599] The video decoding device 100 can determine the position of the current transform coefficient blkpos by adding the index information setPos, which indicates the position of the first coefficient of the current coefficient group in the ScanOrder arrangement according to the forward scanning order, to the current value of n.

[0600] When the value of the valid transform coefficient flag of the current transform coefficient is 1, and the value of the flag sign_data_hiding_enabled_flag indicating whether to activate hidden symbol data is 0, or there is no hidden symbol for the current block !signHidden[i], or the position of the current transform coefficient in the current coefficient group in the forward scan order is not the first valid transform coefficient firstSigScanPos, information related to the symbol of the current transform coefficient can be obtained from the bit stream: sign[blkpos].

[0601] Figures 9d to 9f A schematic diagram illustrating the residual coding syntax structure according to another embodiment is shown.

[0602] refer to Figures 9d to 9f The video decoding device 100 can scan syntax element information related to the transform coefficients and perform decoding on the transform coefficients based on the scanned syntax element information to recover the transform coefficients.

[0603] First, the video decoding device 100 can obtain the syntax element information last_sig_coeff_x and last_sig_coeff_y from the bitstream. The syntax element information last_sig_coeff_x and last_sig_coeff_y indicates the coordinates used to specify the scan area. At this time, the syntax element information last_sig_coeff_x can indicate the horizontal (x-axis) coordinate value of the last valid transform coefficient in the forward scan order, based on the coordinates of the upper left corner of the current block. The syntax element information last_sig_coeff_y can indicate the vertical (y-axis) coordinate value of the last valid transform coefficient in the current block, based on the coordinates of the upper l...

Claims

1. A video decoding method, comprising the following steps: Obtain the x-axis and y-axis coordinates of a quadrilateral scan region containing one or more valid transformation information from the bitstream; The quadrilateral scanning area is determined based on the x-axis and y-axis coordinate information; Based on the area of ​​the quadrilateral scanning region and the position of the current transform coefficients within the quadrilateral scanning region, a first context model is determined for the first flag information, wherein... The first flag indicates whether the current transform coefficient in the quadrilateral scan area is 0; The first flag information is obtained using the first context model; Based on the position of the current transform coefficient in the quadrilateral scanning region, a second context model is determined for the second flag information, wherein the second flag information indicates whether the current transform coefficient in the quadrilateral scanning region is greater than 1; The second flag information is obtained using the second context model; The current transformation coefficients are determined based on the first and second flag information; Generate a residual block using the current transform coefficients; and Reconstruct the current block based on the resulting residual block.

2. A video encoding method, comprising the following steps: Obtain the transformation coefficients of the current block; Determine the x-axis and y-axis coordinates of a quadrilateral scan region that includes one or more valid transformation information from the current block; Based on the area of ​​the quadrilateral scanning region and the position of the current transform coefficients within the quadrilateral scanning region, a first context model is determined for the first flag information, wherein... The first flag indicates whether the current transform coefficient in the quadrilateral scan area is 0; Based on the position of the current transform coefficient in the quadrilateral scanning region, a second context model is determined for the second flag information, wherein the second flag information indicates whether the current transform coefficient in the quadrilateral scanning region is greater than 1; The first flag information is entropy-encoded using a first context model, and the second flag information is entropy-encoded using a second context model; and Use a context model to entropy encode the tag information; Generate a bit stream that includes entropy-encoded first flag information, entropy-encoded second flag information, x-axis coordinate information corresponding to the x-coordinate, and y-axis coordinate information corresponding to the y-coordinate.

3. A method for transmitting a bit stream, the method comprising the following steps: Perform the video encoding method according to claim 2 to generate a bitstream; and Send the bit stream.

Citation Information

Patent Citations

  • Video encoding and decoding using transforms

    CN103404141A

  • Video decoding method

    CN105007489A