Video decoding method and apparatus therefor, and video encoding method and apparatus therefor
By determining the quadrilateral scanning region in the video codec and combining binarization and context model binary arithmetic coding, the problem of low entropy coding efficiency in the prior art is solved, and more efficient video encoding and decoding processing is achieved.
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-10
AI Technical Summary
Existing video codecs have low entropy coding efficiency when encoding high-resolution or high-quality video content, especially when dealing with a large number of prediction errors, and the reduction in data volume is not significant.
By defining a quadrilateral scanning region that includes all valid transform coefficients within the current block, scanning the transform coefficients in a predetermined scanning order, and combining binarization, debinarization, and binary arithmetic encoding/decoding of the context model, the entropy encoding/decoding efficiency is improved.
It improves the entropy encoding and decoding efficiency of video codecs, reduces unnecessary scanning, and improves the efficiency of correlation processing of neighboring information of transform coefficients.
Smart Images

Figure 1
Abstract
Description
[0001] This application is a divisional application of a patent application with application number 201880089303.1, title "Video decoding method and apparatus therefor, and video encoding method and apparatus therefor", and filed on March 30, 2018. TECHNICAL FIELD
[0002] The disclosure relates to a video decoding method and a video encoding method. In detail, it relates to entropy decoding and entropy encoding. BACKGROUND
[0003] As development and popularization of hardware capable of reproducing and storing high-resolution or high-quality video content, the need for a video codec for efficiently encoding or decoding high-resolution or high-quality video content is increasing. In the existing video codec, a video is encoded according to a limited encoding method of a coding unit based on a tree structure.
[0004] Image data of a spatial domain is transformed into a coefficient of a frequency domain via frequency transform. In order to perform fast calculation of frequency transform, a video codec divides an image into a block having a predetermined size, performs a discrete cosine transform (DCT) on each block, and encodes a frequency coefficient of a block unit. The coefficient of the frequency domain is easily compressed compared to the image data of the spatial domain. In particular, the image pixel value of the spatial domain is expressed as a prediction error through inter prediction or intra prediction of the video codec, so when frequency transform is performed on the prediction error, a large amount of data can be transformed into 0. According to the video codec, the amount of data can be reduced by replacing data that is continuously and repeatedly generated with small data. SUMMARY
[0005] TECHNICAL PROBLEM
[0006] According to various embodiments, by determining a scanning region based on various elements, scanning information related to a coefficient, performing binarization / debinarization and context model-based binarization arithmetic encoding / decoding, entropy encoding / decoding efficiency can be improved.
[0007] A computer-readable recording medium having recorded thereon a program for executing the method according to various embodiments can be included.
[0008] Here, aspects of various embodiments are not limited thereto, and other technical problems not mentioned will be clearly understood by those skilled in the art from the following description.
[0009] TECHNICAL SOLUTION
[0010] The technical problems of the present application are not limited to the above-mentioned features, and those of ordinary skill in the art can clearly understand the unmentioned or other technical problems from the following description.
[0011] A video decoding method according to various embodiments includes the steps of determining a quadrangular scanning region including all significant transform coefficients within a current block; scanning information about transform coefficients within the quadrangular scanning region in a predetermined scanning order; and obtaining transform coefficients of the current block based on the scanned information about the transform coefficients; performing inverse quantization and inverse transform on 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.
[0012] The quadrangular scanning region includes all significant transform coefficients within the current block, and other regions of the current block other than the quadrangular scanning region include only transform coefficients that are not significant transform coefficients and have a value of 0.
[0013] The step of determining the quadrangular scanning region includes the steps of obtaining information about coordinates of a designated quadrangular scanning region from a bitstream; and determining the quadrangular scanning region including all significant transform coefficients within the current block based on the information about the coordinates of the designated quadrangular scanning region, wherein the coordinates of the designated quadrangular scanning region can indicate a horizontal direction coordinate for a most right significant transform coefficient within the current block and a vertical direction coordinate for a most bottom significant transform coefficient within the current block.
[0014] The step of obtaining the information about the coordinates of the designated quadrangular scanning region from the bitstream can further include performing context-based binary arithmetic decoding on the information about the coordinates of the designated quadrangular scanning region; and obtaining de-binary information about the coordinates of the designated quadrangular scanning region by performing de-binary using a predetermined de-binary method on the binary arithmetic decoded information.
[0015] The context model can be determined based on at least one of a size of the current block, a color component of the current block, and a bin index.
[0016] The predetermined de-binary method can be at least one of a fixed length de-binary method and a truncated unary de-binary method.
[0017] The predetermined scanning order can be an order in an inverse zig-zag scan or an order in an inverse diagonal scan.
[0018] The predetermined scan order can be determined based on at least one of a horizontal direction coordinate of a rightmost significant transform coefficient pixel within the current block and a vertical direction coordinate of a lowermost significant transform coefficient pixel within the current block.
[0019] The information related to the transform coefficient includes at least one of flag information indicating whether an absolute value of the transform coefficient is greater than a predetermined value, remaining level information related to the absolute value of the transform coefficient, sign information of the transform coefficient, and binarization parameter information for inverse binarization of the transform coefficient, the predetermined value can be at least one of 0, 1, 2.
[0020] The obtaining the transform coefficient of the current block based on the scanned information related to the transform coefficient can include obtaining the transform coefficient of the current block by performing at least one of binarization arithmetic decoding and inverse binarization based on a context model related to the flag information indicating whether the absolute value of the transform coefficient is greater than the predetermined value.
[0021] The flag information indicating whether the absolute value of the transform coefficient is greater than the predetermined value includes a first transform coefficient, and a context model related to the flag information indicating whether the absolute value of the first transform coefficient is greater than the predetermined value can be determined based on at least one of information related to at least one second transform coefficient previously scanned according to the predetermined scan order, a position of the first transform coefficient within the current block and a color component, information related to a surrounding transform coefficient on a right side or a lower side and a scan position of the first transform coefficient, a relative position of the first transform coefficient within a scan region, and whether at the first scan position.
[0022] The information related to the transform coefficient includes flag information indicating whether an absolute value of the transform coefficient is greater than a predetermined value, and a maximum count of the flag information obtainable from a bitstream can be determined based on a size of a scan region.
[0023] The scan order of each transform coefficient within the quadrangular scan region is determined according to a predetermined scan order, and the scanning the information related to the transform coefficient within the quadrangular scan region according to the predetermined scan order can include scanning the information related to the transform coefficient within the quadrangular scan region according to the scan order of each transform coefficient within the quadrangular scan region.
[0024] At least one coefficient group including a predetermined number of transform coefficients within the quadrangular scan region can be determined according to a predetermined forward scan order, and whether information related to a sign of at least one transform coefficient is hidden can be determined in units of the coefficient group.
[0025] A video decoding apparatus according to various embodiments can include an entropy decoding unit determining a quadrangular scanning region including all of the significant transform coefficients within a current block, scanning information about the transform coefficients within the quadrangular scanning region in a predetermined scanning order, and obtaining transform coefficients of the current block based on the scanned information about the transform coefficients; and a picture restoring unit generating a residual block of the current block by performing inverse quantization and inverse transform on the transform coefficients of the current block, and restoring the current block based on the generated residual block.
[0026] A video encoding method according to various embodiments can include obtaining transform coefficients of a current block, determining a quadrangular scanning region including all of the significant transform coefficients within the current block, scanning information about the transform coefficients included in the quadrangular scanning region in a predetermined scanning order, generating entropy-encoded information based on the scanned information about the transform coefficients by entropy encoding, and generating a bitstream including the entropy-encoded information.
[0027] According to another aspect of the disclosure, a computer-readable recording medium having recorded thereon a program for executing a method according to various embodiments.
[0028] Advantageous Effects
[0029] According to various embodiments, by determining a scanning region based on various elements, scanning information about coefficients, performing binarization / debinarization-based and context model-based binary arithmetic encoding / decoding, it is possible to improve the efficiency of entropy encoding / decoding. In particular, in the process of entropy encoding / decoding information about transform coefficients, it is possible to determine a quadrangular scanning region including all of the significant transform coefficients within a current block, to reduce unnecessary scanning by scanning transform coefficients within the quadrangular scanning region, and to improve the efficiency of entropy encoding / decoding by scanning transform coefficients associated with each other adjacently. BRIEF DESCRIPTION OF DRAWINGS
[0030] Figure 1 a A block diagram of a video decoding apparatus according to various embodiments is illustrated.
[0031] Figure 1 b A flowchart of a video decoding method according to various embodiments is illustrated.
[0032] Figure 1 c A block diagram of a video encoding apparatus according to various embodiments is illustrated.
[0033] Figure 1 d A flowchart of a video encoding method according to various embodiments is illustrated.
[0034] Figure 1 e A block diagram of a picture decoding unit according to various embodiments is illustrated.
[0035] Figure 1 f A block diagram of an image decoding section according to various embodiments is illustrated.
[0036] Figure 2 A diagram for explaining a method of scanning intra-block transform coefficients according to an embodiment.
[0037] Figure 3a A diagram for explaining a method of scanning intra-block transform coefficients according to another embodiment.
[0038] Figure 3b A diagram for explaining operations of determining intra-block coefficient groups (sub-blocks) and operations performed per coefficient group according to another embodiment.
[0039] Figure 4 A diagram for explaining a process of determining a context model for context-based binary arithmetic coding of information related to transform coefficients according to an embodiment.
[0040] Figure 5 A diagram for explaining a process of determining a context model for context-based binary arithmetic coding of information related to transform coefficients according to another embodiment.
[0041] Figure 6a A diagram for explaining a horizontal-first zigzag scan order of scanning information related to intra-block transform coefficients according to an embodiment.
[0042] Figure 6b A diagram for explaining a vertical-first zigzag scan order of scanning information related to intra-block transform coefficients according to an embodiment.
[0043] Figure 7a A diagram for explaining a horizontal scan order of scanning information related to intra-block transform coefficients according to an embodiment.
[0044] Figure 7b A diagram for explaining a vertical scan order of scanning information related to intra-block transform coefficients according to an embodiment.
[0045] Figure 8 A diagram for explaining a diagonal scan order of scanning information related to intra-block transform coefficients according to an embodiment.
[0046] Figures 9a to 9c A diagram for explaining a residual coding syntax structure according to an embodiment.
[0047] Figures 9d to 9f A diagram for explaining a residual coding syntax structure according to another embodiment.
[0048] Figure 10FIG. illustrates a process of determining at least one coding unit by partitioning a current coding unit according to an embodiment.
[0049] Figure 11 FIG. illustrates a process of determining at least one coding unit by partitioning a coding unit having a non-square shape according to an embodiment.
[0050] Figure 12 FIG. illustrates a process of partitioning a coding unit based on at least one of block shape information and partition shape information according to an embodiment.
[0051] Figure 13 FIG. illustrates a method of determining a predetermined coding unit from among an odd number of coding units according to an embodiment.
[0052] Figure 14 FIG. illustrates an order in which a plurality of coding units are processed when the plurality of coding units are determined by partitioning a current coding unit according to an embodiment.
[0053] Figure 15 FIG. illustrates a process of determining that a current coding unit is to be partitioned into an odd number of coding units when the coding units cannot be processed in a predetermined order according to an embodiment.
[0054] Figure 16 FIG. illustrates a process of determining at least one coding unit by partitioning a first coding unit according to an embodiment.
[0055] Figure 17 FIG. illustrates that a shape into which a second coding unit having a non-square shape determined by partitioning a first coding unit is limited when the second coding unit satisfies a predetermined condition according to an embodiment.
[0056] Figure 18 FIG. illustrates a process of partitioning a coding unit having a square shape when partition shape information does not indicate partitioning into four square-shaped coding units according to an embodiment.
[0057] Figure 19 FIG. illustrates that a processing order among a plurality of coding units can be changed according to a partitioning process of the coding units according to an embodiment.
[0058] Figure 20 FIG. illustrates a process of determining a depth of a coding unit as a shape and size of the coding unit change when a plurality of coding units are determined by recursively partitioning the coding unit according to an embodiment.
[0059] Figure 21 FIG. illustrates a use of an index (PID) of a coding unit for distinguishing a depth that can be determined according to a shape and size of the coding unit according to an embodiment.
[0060] Figure 22 FIG. 13 illustrates determining a plurality of coding units according to a plurality of specific data units included in a picture according to an embodiment.
[0061] Figure 23 FIG. 14 illustrates a processing block serving as a reference for determining an order of determining a reference coding unit included in a picture according to an embodiment.
[0062] Optimal mode
[0063] A video decoding method according to various embodiments can include determining a quadrangular scan region including all active transform coefficients within a current block, scanning information about transform coefficients within the quadrangular scan region in a predetermined scan order, and obtaining transform coefficients of the current block based on the scanned information about transform coefficients, performing inverse quantization and inverse transform on 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.
[0064] A video decoding apparatus according to various embodiments can include an entropy decoding unit determining a quadrangular scan region including all active transform coefficients within a current block, scanning information about transform coefficients within the quadrangular scan region in a predetermined scan order, and obtaining transform coefficients of the current block based on the scanned information about transform coefficients, and an image restoring unit performing inverse quantization and inverse transform on 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.
[0065] A video encoding method according to various embodiments can include obtaining transform coefficients of a current block, determining a quadrangular scan region including all active transform coefficients within the current block, scanning information about transform coefficients included in the quadrangular scan region in a predetermined scan order, entropy encoding based on the scanned information about transform coefficients to generate entropy-encoded information, and generating a bitstream including the entropy-encoded information.
[0066] According to another aspect of the disclosure, a computer-readable recording medium having recorded thereon a program for executing a method according to various embodiments. DETAILED DESCRIPTION
[0067] Hereinafter, an "image" can indicate a still image or a moving image of a video, i.e., a video itself.
[0068] Hereinafter, a "sample" indicates data assigned to a sampling position of an image and data of an object to be processed. For example, a pixel in an image of a spatial domain can be a sample.
[0069] Hereinafter, a "current block" can indicate a block of an image to be encoded or decoded.
[0070] Figure 1 a A block diagram of a video decoding apparatus according to various embodiments is illustrated.
[0071] An image decoding apparatus according to various embodiments can include an entropy decoding unit 105 and an image restoring unit 120.
[0072] The entropy decoding unit 105 can obtain syntax element information received from a bitstream and entropy-decode the syntax element information. At this time, the syntax element information received from the bitstream can be information related to various syntax elements regarding an image.
[0073] The entropy decoding unit 105 can obtain syntax element information related to transform coefficients within a current block from a bitstream and entropy-decode the syntax element information related to the transform coefficients within the current block. At this time, the current block can be a block to be decoded. Figures 10 to 23 An encoding unit usable in a process of encoding / decoding an image is described.
[0074] The entropy decoding unit 105 can scan the entropy-decoded syntax element information related to transform coefficients within a current block in a predetermined scan order to obtain information related to the transform coefficients within the current block. The predetermined scan order can be a reverse scan order. Here, the reverse scan order can be an order of scanning transform coefficient pixels from a pixel at a right lower end within a block to a pixel at a left upper end within the block. An order of scanning transform coefficients from a top left transform coefficient pixel to a transform coefficient located at a right lower side can be referred to as a forward scan order, and an order of scanning transform coefficients from a last transform coefficient located at a right lower side to a left upper transform coefficient can be referred to as a reverse scan order. The syntax element information related to the transform coefficients within the current block can be flag information indicating whether the transform coefficients within the current block are greater than a predetermined value. At this time, the predetermined value can be an integer value greater than or equal to 0. For example, it can be 0, 1, or 2.
[0075] Also, the syntax element information related to the transform coefficient in the current block can refer to syntax element information indicating a remaining level absolute value. The remaining level absolute value can indicate a difference between an absolute value of a level of the transform coefficient and an absolute value of a base level. The absolute value of the base level can be determined based on syntax element information indicating whether an absolute value of the transform coefficient is greater than a predetermined value. For example, a sum of a value of flag information (Greater than 0 flag or sig_coeff_flag; hereinafter, referred to as GT0 flag) indicating whether an absolute value of the transform coefficient is greater than 0 (or whether the transform coefficient is a significant transform coefficient; here, the significant transform coefficient indicates a transform coefficient whose absolute value is greater than 0), a value of flag information (Greater than 1 flag or coeff_abs_level_greater1_flag; hereinafter, referred to as GT1 flag) indicating whether greater than 1, and a value of flag information (Greater than 2 flag or coeff_abs_level_greater2_flag; referred to as GT2 flag) indicating whether greater than 2 can be the absolute value of the base level. Here, when the flag information indicating whether an absolute value of the transform coefficient is greater than a predetermined value indicates greater than the predetermined value, the value of the flag information can be 1, and when indicating less than the predetermined value, the value of the flag information can be 0. It can not be possible to obtain a part of the flag information from the bitstream. According to an embodiment, when a flag indicating whether a size of the transform coefficient is greater than n (n is an integer) is referred to as GTn, a flag indicating whether the size of the transform coefficient is greater than (n+1) is referred to as GT(n+1), and a flag indicating whether the size of the transform coefficient is greater than (n+2) is referred to as GT(n+2), only a flag indicating whether the absolute value of the transform coefficient is greater than n or n+1, which is relatively smaller among reference values of n, n+1, and n+2 (i.e., GTn and GT(n+1)) can be transmitted, and GT(n+2) can not be included in the bitstream.
[0076] 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, in a case where the GT2 flag is not included in the bitstream, the GT2 flag is excluded and only the GT0 flag information and the GT1 flag information are used, so the absolute value of the transform coefficient is greater than 1, and thus the entropy decoding unit 105 determines a remaining absolute value obtained by subtracting 2 from the absolute value of the transform coefficient as the remaining level absolute value of the transform coefficient.
[0077] When the GT0 flag information, the GT1 flag information, and the GT2 flag information indicate more than 0, 1, and 2, respectively, since the absolute value of the transform coefficient is more than 2, the entropy decoding unit 105 can determine the remaining absolute value obtained by subtracting 3 from the absolute value of the transform coefficient as the absolute value of the remaining level of the transform coefficient. In other words, the remaining level absolute value can indicate the absolute value difference between the predetermined absolute value determined based on the information whether the absolute value of the transform coefficient is more than the predetermined value and the absolute value of the significant transform coefficient.
[0078] The entropy decoding unit 105 can obtain the syntax element information received from the bitstream, perform binary arithmetic decoding on the syntax element information, and can perform debinarization on the output (i.e., bin string) generated by the binary arithmetic decoding. At this time, the binary arithmetic decoding operation can be performed at the binary arithmetic decoding unit 110, and the debinarization operation can be performed at the debinarization unit 115.
[0079] The binary arithmetic decoding unit 110 can perform binary arithmetic decoding on the syntax element information obtained from the bitstream based on a predetermined context model. Here, the context model can be information related to the occurrence probability of a bin. The information related to the occurrence probability of a bin can include information (valMPS) indicating one of a symbol (i.e., Least Probable Symbol (LPS)) having a relatively low occurrence probability and a symbol (i.e., Most Probable Symbol (MPS)) having a relatively high occurrence probability among two symbols 0 and 1 and information related to the occurrence probability of the one symbol. The occurrence probability has a value between 0 and 1. Accordingly, when determining the probability of one of the MPS and the LPS, the information related to the occurrence probability of the other symbol is information related to the remaining probability from 1 of the determined symbol, so the binary arithmetic decoding unit 110 can determine the occurrence probability of the remaining symbol when determining the occurrence probability of the one symbol. At this time, the occurrence probability of the one symbol determined first can be the occurrence probability of the LPS (Least Probable Symbol). The occurrence probability of the symbol corresponding to the index value can be determined on a table in advance, and the information of the occurrence probability of the symbol can be information (pStateIdx) indicating an index indicating the determined occurrence probability of the symbol on the table.
[0080] The predetermined context model can be determined based on a bin index indicating the position of a bin, the occurrence probabilities of both included in the surrounding blocks of the block including the bin, various elements of the current block or the surrounding blocks, etc.
[0081] Alternatively, the binary arithmetic decoding unit 110 can perform binary arithmetic decoding on the syntax element information obtained from the bitstream according to a by-pass mode. At this time, the probability of obtaining 0 or 1 is fixed to 0.5 with respect to a bin that is currently subjected to binary arithmetic decoding, and binary arithmetic decoding can be performed on the syntax element information based on such a probability.
[0082] The de-binarization unit 115 can perform de-binarization on an output value (i.e., a bin string) generated by performing binary arithmetic decoding. The de-binarization unit 115 can perform de-binarization on the bin string based on a de-binarization method corresponding to a predetermined binarization method. The predetermined binarization method can 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 can be a binarization method in which a first binarization method and a second binarization method are combined with each other. For example, the de-binarization unit 115 can perform de-binarization on a part (i.e., a first bin string) of the bin string of the syntax element based on a de-binarization method corresponding to the first binarization method, and perform de-binarization on a part (i.e., a second bin string) of the bin string of the syntax element based on a de-binarization method corresponding to the second binarization method. The part of the bin string can be a prefix or a suffix of the bin string of the syntax element.
[0083] The binarization method or the de-binarization method is related to a code word that defines a one-to-one (1:1) correspondence relationship of a bin string including at least one bin corresponding to a syntax element value. In the encoding aspect, the bin string including at least one bin corresponding to a syntax element value can be determined according to one of the above-described various binarization methods, and in the decoding aspect, the syntax element value corresponding to the bin string can be determined according to the de-binarization method. For example, when a bin string A corresponding to a syntax element value a (a is a real number) is determined according to a predetermined binarization / de-binarization method, a process of determining the bin string A with the syntax element value a as a reference is referred to as a binarization process, and a process of determining the syntax element value a with the bin string A as a reference can be referred to as a de-binarization process. However, as described above, the binarization and the de-binarization are basically used to define a mapping relationship between a syntax element value and a bin string, and a person skilled in the art would easily understand that the binarization and the de-binarization are basically the same.
[0084] The entropy decoding unit 105 can perform entropy decoding by scanning syntax element information related to the transform coefficients within the current block in a predetermined scan order, thereby obtaining information related to the transform coefficients within the current block. The predetermined scan order can be an order according to an inverse zigzag scan or an order according to an inverse diagonal scan. However, the predetermined scan order can be various scan orders according to an inverse horizontal scan and an order according to a vertical scan, etc. The predetermined scan order can be determined based on at least one of a horizontal direction coordinate (e.g., an x coordinate (x is an integer) of a rectangular coordinate system) value of a rightmost valid transform coefficient pixel within the current block and a vertical direction coordinate (e.g., a y coordinate (y is an integer) of a rectangular coordinate system) value of a lowermost valid transform coefficient pixel within the current block. For example, the entropy decoding unit 105 can determine the predetermined scan order based on the size of the horizontal direction coordinate value and the size of the vertical direction coordinate value. When the horizontal direction coordinate value is greater than the vertical direction coordinate value, the entropy decoding unit 105 can determine an inverse vertical scan order as the predetermined scan order. When the vertical direction coordinate value is greater than the horizontal direction coordinate value, the entropy decoding unit 105 can determine an inverse horizontal scan order as the predetermined scan order.
[0085] Alternatively, when the horizontal direction coordinate value is greater than the vertical direction coordinate value, the entropy decoding unit 105 can determine an inverse vertical first zigzag scan order as the predetermined scan order. Referring to FIG. 6, the inverse vertical first zigzag scan order is an order in which a zigzag scan is performed in a vertical direction first and then a zigzag scan is performed in a horizontal direction. Figure 6b The detailed contents for the vertical first zigzag scan order are described. When the vertical direction coordinate value is greater than the horizontal direction coordinate value, the entropy decoding unit 105 can determine an inverse horizontal first zigzag scan order as the predetermined scan order. Referring to FIG. 7, the inverse horizontal first zigzag scan order is an order in which a zigzag scan is performed in a horizontal direction first and then a zigzag scan is performed in a vertical direction. Figure 6a The detailed contents for the horizontal first zigzag scan order are described. When the vertical direction coordinate value is equal to the horizontal direction coordinate value, the entropy decoding unit 105 can determine one of an inverse vertical first zigzag scan order and an inverse horizontal first zigzag scan order as the predetermined scan order.
[0086] Alternatively, when the horizontal direction coordinate value is greater than the vertical direction coordinate value, the entropy decoding unit 105 can determine an inverse horizontal first zigzag scan order as the predetermined scan order. When the horizontal direction coordinate value is not greater than the vertical direction coordinate value, the entropy decoding unit 105 can determine an inverse vertical first zigzag scan order as the predetermined scan order.
[0087] Before scanning information related to the transform coefficients, the entropy decoding unit 105 can determine a quad scan region including all the significant transform coefficients within the current block. At this time, all the significant transform coefficients within the current block are included in the quad scan region, and the remaining region within the current block other than the quad scan region can include only transform coefficients of 0 which are not significant transform coefficients.
[0088] The entropy decoding unit 105 can obtain information related to coordinates of a specified quad scan region from the bitstream. The information related to the coordinates of the specified quad scan region can include information related to a coordinate of a horizontal direction for a rightmost significant transform coefficient within the current block and information related to a coordinate of a vertical direction for a lowermost significant transform coefficient within the current block. However, it is not limited thereto, and the information related to the coordinates of the specified quad scan region can include only information related to a greater value between a coordinate value of a horizontal direction for a rightmost significant transform coefficient within the current block and a coordinate value of a vertical direction for a lowermost significant transform coefficient within the current block. At this time, the specified quad scan region as a square scan region can determine a coordinate value of the other direction using the coordinate value of one direction obtained from the bitstream, and can determine the square scan region based on the determined horizontal direction coordinate value and the vertical direction coordinate value. At this time, the determined horizontal direction coordinate value and the vertical direction coordinate value can indicate coordinate values of a pixel located at a right lower corner of the quad scan region. In other words, when only a coordinate of one direction is obtained from the bitstream, the entropy decoding unit 105 can determine a specified square scan region, can determine coordinate values of the specified quad scan region based on the obtained coordinate value of one direction, and can determine a square scan region based on the coordinate values of the specified square scan region.
[0089] The entropy decoding unit 105 can determine a quad scan region including all the significant transform coefficients within the current block based on the information related to the coordinates of the specified quad scan region.
[0090] The entropy decoding unit 105 can perform context-based binarization decoding on information related to coordinates of a specified quadtree scan region. The entropy decoding unit 105 can perform de-binarization on the binarization-decoded information based on a de-binarization method corresponding to a predetermined binarization method to obtain de-binarization information related to the coordinates of the specified quadtree scan region, and can obtain the coordinates of the specified quadtree scan region from the de-binarization information related to the coordinates. At this time, the context model can be determined based on one of a size of a current block, a color component of the current block, and a bin index. The color component can include a luma component and a chroma component. The bin index can be information indicating a position of a bin that is currently to be binarization-decoded in a bin string related to a syntax element. The de-binarization method corresponding to the predetermined binarization method can be at least one of a fixed length de-binarization method and a truncated unary de-binarization method. For example, the entropy decoding unit 105 can perform de-binarization using the fixed length de-binarization method on a first bin string in the binarization-decoded information to obtain first de-binarization information, and perform de-binarization using the truncated unary de-binarization method on a second bin string in the binarization-decoded information to obtain second de-binarization information. The entropy decoding unit 105 can obtain the coordinates of the specified quadtree scan region based on the first de-binarization information and the second de-binarization information.
[0091] The entropy decoding unit 105 can perform at least one of context-based binarization decoding and de-binarization based on information related to a significant transform coefficient scanned in the quadtree scan region to obtain a transform coefficient of the current block.
[0092] When the information related to the transform coefficient is information indicating whether an absolute value of a 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-based binarization decoding on the scanned information related to the transform coefficient. The entropy decoding unit 105 can perform de-binarization on the binarization-decoded information related to the transform coefficient to obtain the transform coefficient of the current block. When the first information related to the transform coefficient is information indicating whether an absolute value of a 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 coefficient is binarization parameter information related to the current transform coefficient, the entropy decoding unit 105 can perform context-based binarization decoding on the first information related to the transform coefficient.
[0093] The entropy decoding unit 105 can perform inverse binarization based on binarization parameter information included in the second information on the first information binarization-decoded to obtain a transform coefficient of the current block. The binarization parameter information can be Rice Parameter information for the current transform coefficient. The Rice Parameter can be information for determining a length of a prefix included in a bin string. However, the binarization parameter information is not limited thereto, and can be various binarization parameter information for the current transform coefficient.
[0094] 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 a value related to the residual level absolute value of the current transform coefficient using an inverse binarization method corresponding to a (truncated) Rice binarization method and an inverse binarization method corresponding to an exponential Golomb binarization method on the residual level absolute value information of the current transform coefficient. For example, the entropy decoding unit 105 can perform inverse binarization using an inverse binarization method corresponding to a Rice binarization method based on a Rice parameter on a prefix of a bin string of the residual level absolute value information of the current transform coefficient to obtain a first value related to the residual level absolute value of the current transform coefficient, perform inverse binarization using an inverse binarization method corresponding to an exponential Golomb method on a suffix of the bin string of the residual level absolute value to obtain a second value related to the residual level absolute value of the current transform coefficient, and obtain a value related to the residual level absolute value of the current block based on the first value related to the residual level absolute value of the current transform coefficient and the second value related to the residual level absolute value of the current transform coefficient.
[0095] In the context model related to the transform coefficient, the context model related to the first transform coefficient can be determined based on at least one of information related to at least one second transform coefficient previously scanned in a predetermined scan order, a position of the first transform coefficient within the current block, a color component, information related to a surrounding transform coefficient on the right or below, and a scan position of the first transform coefficient.
[0096] For example, the context model related to flag information indicating whether the first transform coefficient is greater than 0 can be determined based on a number of transform coefficients on the right or below having an absolute value greater than 0 among transform coefficients on the right or below in a predetermined position.
[0097] However, the context model related to the flag information indicating whether the first transform coefficient is greater than 0 can be determined based on a number of significant transform coefficients having an absolute value greater than 0 among n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order.
[0098] Alternatively, a context model related to the flag information indicating whether the first transform coefficient is greater than 0 can be determined based on a position of the first transform coefficient within a corresponding coefficient group and flags of surrounding right or lower side effective coefficient groups corresponding thereto.
[0099] Alternatively, the flag information (GT0 flag information) indicating whether the first transform coefficient is greater than 0 can be determined based on at least one of GT0 flag information of n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order and GT0 flag information of n (n is a positive integer) transform coefficients of a position, a color component, and neighboring right or lower side of the first transform coefficient within the current block, whether the first transform coefficient is a transform coefficient at an initial position in a scan region in a scan order, and whether the first transform coefficient is a transform coefficient at a final position in the scan region in the scan order.
[0100] 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 a number of right or lower side effective transform coefficients having an absolute value greater than 1 among transform coefficients of a right or lower side of a predetermined position.
[0101] However, not limited thereto, 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 a number of effective transform coefficients having an absolute value greater than 1 among n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order.
[0102] Alternatively, 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 GT1 flag information previously decoded within a corresponding coefficient group and GT1 flag information within the group previously decoded.
[0103] Alternatively, the flag information of whether the absolute value of the first transform coefficient is greater than 1 can be determined based on at least one of GT1 flag information of n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order and GT1 flag information of n (n is a positive integer) transform coefficients of a position, a color component, and neighboring right or lower side of the first transform coefficient within the current block, whether the first transform coefficient is a transform coefficient at an initial position within a scan region, and whether the first transform coefficient is a transform coefficient at a final position within the scan region.
[0104] 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 a number of right or lower side effective transform coefficients having an absolute value greater than 2.
[0105] However, without limitation, 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 significant transform coefficients having an absolute value greater than 2 among n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order.
[0106] Alternatively, 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 GT2 flag information previously decoded within the corresponding group of coefficients and GT2 flag information within the group previously decoded.
[0107] 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 GT2 flag information of n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order and the position of the first transform coefficient within the current block, GT2 flag information of n (n is a positive integer) transform coefficients adjacent to the right or lower side of the color component of the first transform coefficient, whether the first transform coefficient is a transform coefficient at the initial position within the scan region, and whether the first transform coefficient is a transform coefficient at the final position within the scan region.
[0108] Alternatively, the flag information indicating whether the first transform coefficient is greater than m (m is an integer greater than 2) can be determined based on at least one of GTm flag information of n (n is a positive integer) transform coefficients previously scanned in a predetermined scan order and the position of the first transform coefficient within the current block, GTm flag information of n (n is a positive integer) transform coefficients adjacent to the right or lower side of the color component of the first transform coefficient, whether the first transform coefficient is a transform coefficient at the initial position within the scan region, and whether the first transform coefficient is a transform coefficient at the final position within the scan region.
[0109] The binarization parameter information related to the remaining level value of the first transform coefficient can be determined based on the absolute values of the levels of the surrounding significant transform coefficients to the right or lower side of the first transform coefficient.
[0110] For example, the binarization parameter information related to the first transform coefficient can be determined based on the sum of the absolute values of the levels of predetermined surrounding significant transform coefficients to the right or lower side of the first transform coefficient.
[0111] Alternatively, the binarization parameter information related to the remaining level value of the first transform coefficient can be determined based on the previously encoded level value.
[0112] Alternatively, the binarization parameter information related to the first transform coefficient can be determined based on at least one of the following: the levels of n (n is an integer) transform coefficients that are previously scanned in the predetermined scan order, the position of the first transform coefficient within the current block, the color component, and the levels of n (n is a positive integer) transform coefficients adjacent to the right side or the lower side of the first transform coefficient, whether the first transform coefficient is a transform coefficient at an initial position within a scan region in the scan order, whether the first transform coefficient is a transform coefficient at a final position within the scan region in the scan order, whether the first transform coefficient is a coefficient at an initial position within a coefficient group in the scan order, and the relative position of the first transform coefficient position within the scan region.
[0113] When the position of the transform coefficient currently scanned within the scan region is [SRx, 0] (SRx is an integer, and SRx indicates a horizontal coordinate value of a pixel at a right side boundary of the scan region with reference to a coordinate of a top-left corner of the scan region), and the transform coefficients at [SRx, Y] (Y is an integer greater than 0 and less than or equal to SRy, and SRy indicates a vertical coordinate value of a pixel at a lower side boundary of the scan region with reference to a coordinate of a top-left corner of the scan region) that are previously scanned in the predetermined scan order are all 0 coefficients, the entropy decoding unit 105 can determine the value of the GT0 flag information to be 1 without obtaining the GT0 flag information of the transform coefficient currently scanned from the bitstream.
[0114] Similarly, when the position of the transform coefficient currently scanned within the scan region is [0, SRy] (SRy is an integer, and SRy indicates a vertical coordinate value of a pixel at a lower side boundary of the scan region with reference to a coordinate of a top-left corner of the scan region), and the transform coefficients at [X, SRy] (X is an integer greater than 0 and less than or equal to SRx, and SRx indicates a vertical coordinate value of a pixel at a right side boundary of the scan region with reference to a coordinate of a top-left corner of the scan region) that are previously scanned in the predetermined scan order are all 0 coefficients, the entropy decoding unit 105 can determine the value of the GT0 flag information to be 1 without obtaining the GT0 flag information of the transform coefficient currently scanned from the bitstream.
[0115] In addition, the entropy decoding unit 105 can determine the maximum number of GT1 flag information of the significant transform coefficients within the current block, and can receive the GT1 flag information within the current block from the bitstream within the determined maximum number of the significant transform coefficients. In other words, after the entropy decoding unit 105 receives the GT1 flag information of the significant transform coefficients received from the bitstream up to the maximum number, the entropy decoding unit 105 can no longer confirm whether the GT1 flag information of the significant transform coefficients exists in the bitstream.
[0116] The entropy decoding unit 105 can determine all of the significant transform coefficients that are not 0 as the maximum number of GT1 flag information within the current block. Alternatively, the entropy decoding unit 105 can determine the maximum number of GT1 flag information within the current block based on the size of the scan region. For example, the entropy decoding unit 105 can determine the maximum number of GT1 flag information MaxCount_GT1 based on the following mathematical expression.
[0117] [Math. 1]
[0118]
[0119] At this time, the sizeSRmay refer to the size (width) of the quadrangular scan region, and the sizeSRmay be (Sr_x+1)*(Sr_y+1). The Sr_xmay indicate the horizontal direction coordinate of the rightmost significant transform coefficient pixel based on the coordinate of the left upper corner of the scan region. In other words, the Sr_xmay indicate the horizontal direction coordinate of the pixel at the right boundary based on the coordinate of the left upper corner of the scan region. The Sr_ymay indicate the vertical direction coordinate of the lowermost significant transform coefficient pixel based on the coordinate of the left upper corner of the scan region. In other words, the Sr_ymay indicate the vertical direction coordinate of the pixel at the lower boundary based on the coordinate of the left upper corner of the scan region.
[0120] The K1may be a regulation coefficient between the size of the scan region and the GT1 flag. For example, the K1may be an integer greater than 1. The Th1may be a predetermined threshold value. For example, the Th1may be 16, 8. However, it is not limited thereto, and those skilled in the art should readily understand that the K1and the Th1may have various values.
[0121] The entropy decoding unit 105 can determine the maximum number of GT2 flag information within the current block, and can receive the GT2 flag information within the current block from the bitstream within the determined maximum number of significant transform coefficients. In other words, after the entropy decoding unit 105 receives the GT2 flag information of the significant transform coefficients received from the bitstream up to the maximum number, the entropy decoding unit 105 can no longer confirm whether the GT2 flag information of the significant transform coefficients exists in the bitstream.
[0122] The entropy decoding unit 105 can determine all of the significant transform coefficients that are not 0 as the maximum number of GT2 flag information within the current block. Alternatively, the entropy decoding unit 105 can determine the maximum number of GT2 flag information within the current block based on the size of the scan region. For example, the entropy decoding unit 105 can determine the maximum number of GT2 flag information MaxCount_GT2 based on the following mathematical expression 2.
[0123] [Math. 2]
[0124]
[0125] At this time, the sizeSR can refer to a size (width) of the quadtree scan region, and the sizeSR can be (Sr_x+1)*(Sr_y+1). The Sr_x can indicate a horizontal direction coordinate of an effective transform coefficient pixel at a rightmost side with the coordinate of the top-left corner of the scan region as a reference. In other words, the Sr_x can indicate a horizontal direction coordinate of a pixel at a right boundary with the coordinate of the top-left corner of the scan region as a reference. The Sr_y can indicate a vertical direction coordinate of an effective transform coefficient pixel at a lowermost side with the coordinate of the top-left corner of the scan region as a reference. In other words, the Sr_y can indicate a vertical direction coordinate of a pixel at a lower boundary with the coordinate of the top-left corner of the scan region as a reference. The K2 can be an adjustment coefficient between the size of the scan region and the GT2 flag. For example, the K2 can be an integer greater than 1. The K2 can be a predetermined threshold value. For example, the Th2 can be 16, 8. However, it is not limited thereto, and those skilled in the art should readily understand that the K2 and the Th2 can have various values.
[0126] The entropy decoding unit 105 can obtain information about a coefficient group within the current block from the bitstream. Here, the information about the coefficient group can refer to flag information indicating whether the coefficient group includes at least one significant transform coefficient (or whether the coefficient group includes only transform coefficients that are 0). The flag information can be referred to as significant coefficient group flag information. The entropy decoding unit 105 can scan information about transform coefficients within the current coefficient group based on the information about the current coefficient group obtained from the bitstream. For example, when the information about the coefficient group indicates that the coefficient group does not include at least one significant transform coefficient, the entropy decoding unit 105 can induce the values of the transform coefficients within the coefficient group to be 0 without scanning the information about the transform coefficients. When the information about the coefficient group indicates that the coefficient group includes at least one significant transform coefficient, the entropy decoding unit 105 can scan the information about the transform coefficients in a predetermined scan order to obtain the transform coefficients within the coefficient group.
[0127] At this time, with respect to the transform coefficients included in the scan region, the entropy decoding unit 105 can determine one coefficient group for each predetermined K (K is an integer) of the transform coefficients scanned in the predetermined scan order. In other words, one coefficient group can include K transform coefficients. At this time, the scan order is a forward scan order in a direction opposite to the predetermined inverse scan order.
[0128] Accordingly, the entropy decoding unit 105 can determine the coefficient group in a forward scanning order from a coefficient (i.e., a DC coefficient) adjacent to the top-left corner within the current block. At this time, when the number of transform coefficients included in the current block is not an integer multiple of K, the last coefficient group among the coefficient groups scanned in the forward scanning order can include a number of transform coefficients less than K.
[0129] However, the entropy decoding unit 105 can determine the coefficient group in a reverse scanning order from a coefficient located at the right lower end among the transform coefficients included in the current block to a coefficient located at the left upper end among the transform coefficients included in the current block, without being limited thereto.
[0130] However, the entropy decoding unit 105 can determine the coefficient group in a predetermined scanning order without obtaining information about the coefficient group within the current block from the bitstream, without being limited thereto. The reason for determining the coefficient group is to make the entropy decoding unit 105 perform an operation (an operation of sign data hiding, etc.) that is processed according to the coefficient group. When one of the coefficient groups scanned in the predetermined scanning order includes only one transform coefficient, the entropy decoding unit 105 can obtain GT0 flag information from the bitstream, instead of obtaining information about the coefficient group from the bitstream.
[0131] The entropy decoding unit 105 can determine to hide a sign of at least one transform coefficient with respect to each of the coefficient groups included in the current block. For example, the entropy decoding unit can determine to hide a sign of one or two transform coefficients with respect to each of the coefficient groups included in the current block.
[0132] The entropy decoding unit 105 can scan information about the transform coefficients within the quadrangular scanning region in a predetermined scanning order. The predetermined scanning order can include a reverse zigzag scanning order, a reverse diagonal scanning order, a reverse vertical scanning order, and a horizontal scanning order. However, it would be readily understood by those skilled in the art that the predetermined scanning order is not limited to the reverse scanning orders mentioned above but can include various reverse scanning orders.
[0133] The entropy decoding unit 105 can obtain the transform coefficients of the current block based on the scanned information about the transform coefficients.
[0134] The image restoring unit 120 can generate a residual block of the current block by inverse quantizing and inverse transforming the transform coefficients of the current block.
[0135] The image restoring unit 120 can restore the current block based on the residual block of the current block.
[0136] The image restoration unit 120 can perform inter prediction or intra prediction on the current block to generate a prediction block of the current block. The image restoration unit 120 can restore the current block based on the prediction block of the current block and the residual block of the current block. In other words, the image restoration unit 120 can add values of pixels included in the prediction block and values of pixels included in the residual block to restore values of pixels included in the current block.
[0137] The video decoding apparatus 100 can include an image decoding section (not shown) which can include the entropy decoding unit 105 and the image restoration unit 120. Referring to Figure 1 e The image decoding unit is described.
[0138] Figure 1 b A flowchart of a video decoding method according to various embodiments is illustrated.
[0139] In step S105, the video decoding apparatus 100 can determine a quadrangular scanning region including all the significant transform coefficients within the current block. At this time, the coordinates specifying the quadrangular scanning region can indicate a horizontal direction coordinate of a rightmost significant transform coefficient pixel among the significant transform coefficients within the current block and a vertical direction coordinate of a lowermost significant transform coefficient pixel among the significant transform coefficients within the current block. The video decoding apparatus 100 can obtain information about the coordinates specifying the quadrangular scanning region from the bitstream and can determine the quadrangular scanning region based on the obtained coordinates specifying the quadrangular scanning region.
[0140] In step S110, the video decoding apparatus 100 can scan information about the transform coefficients within the quadrangular scanning region in a predetermined scanning order. The predetermined scanning order can include a reverse zigzag scanning order or a reverse diagonal scanning order. The zigzag scanning order can include a vertical-first zigzag scanning order or a horizontal-first zigzag scanning order.
[0141] In step S115, the video decoding apparatus 100 can obtain the transform coefficients of the current block based on the scanned information about the transform coefficients.
[0142] In step S120, the video decoding apparatus 100 can perform inverse quantization and inverse transform on the transform coefficients of the current block to generate a residual block of the current block.
[0143] In step S125, the video decoding apparatus 100 can restore the current block based on the residual block. The video decoding apparatus 100 can generate a prediction block of the current block by performing inter prediction or intra prediction. Also, the video decoding apparatus 100 can add pixel values included in the prediction block of the current block and pixel values of the residual block to generate pixel values of the restored block of the current block.
[0144] Figure 1 c FIG. 2 illustrates a block diagram of a video encoding apparatus according to various embodiments.
[0145] The video decoding apparatus 150 according to various embodiments includes an entropy decoding unit 155 and a bitstream generating unit 170.
[0146] The entropy decoding unit 155 can entropy-decode syntax elements related to transform coefficients within a current block. The entropy decoding unit 155 generates one-dimensional arrangement information related to transform coefficients within a current block by scanning two-dimensional arrangement information related to transform coefficients within the current block in a predetermined scan order, and entropy-decodes the one-dimensional arrangement information related to transform coefficients within the current block.
[0147] The syntax elements related to transform coefficients can be a flag indicating whether a transform coefficient is greater than a predetermined value. At this time, the predetermined value can be a value greater than or equal to 0. For example, it can be 0, 1, or 2. Also, it can be a syntax element indicating a remaining level absolute value related to a transform coefficient. In other words, the remaining level absolute value can indicate an absolute value difference between a transform coefficient absolute value and a predetermined absolute value determined based on whether it is greater than a predetermined value. Also, the syntax elements related to significant transform coefficients can be syntax elements related to a sign of a significant transform coefficient.
[0148] First, the entropy decoding unit 155 can generate entropy-decoded information of syntax elements by generating a bin string by performing binarization on the syntax elements and performing binary arithmetic encoding on the bin string. At this time, binarization can be performed in the binarization unit 160, and binary arithmetic encoding can be performed in the binary arithmetic encoding unit 165.
[0149] The binarization unit 160 can perform binarization on the predetermined syntax element to generate a bin string. The binarization unit 160 can perform binarization on the predetermined syntax element based on a predetermined binarization method. The predetermined binarization method can include a fixed length (Fixed Length) binarization method, a Rice binarization method, an Exponential Golomb binarization method, and a Golomb-Rice binarization method. Alternatively, the predetermined binarization method can be a method in which a first binarization method and a second binarization method are combined with each other. For example, the binarization unit 160 can perform binarization on a part of the syntax element based on the first binarization method to generate a first bin string, and can perform binarization on another part of the syntax element based on the second binarization method to generate a second bin string. At this time, the first bin string can be a part of a bin string of the syntax element, and the second bin string can be another part of the bin string of the syntax element. The part of the bin string can be a prefix or a suffix.
[0150] The binarization arithmetic encoding unit 165 can perform binarization arithmetic encoding on the bin string related to the predetermined syntax element based on a predetermined context model. Alternatively, the binarization arithmetic encoding unit 165 can perform binarization arithmetic encoding on the bin string related to the predetermined syntax element without using the predetermined context model. At this time, a probability of obtaining 0 or 1 for a bin currently being binarization arithmetic encoded is fixed to 0.5, and the binarization arithmetic encoding can be performed based on such a probability.
[0151] The entropy encoding unit 155 can obtain a transform coefficient of a current block. In other words, the video decoding apparatus 150 can generate a prediction block of the current block by performing inter prediction or intra prediction, and generate a residual block of the current block based on an original block of the current block and the prediction block of the current block. The video encoding apparatus 150 can generate a transform coefficient of the current block by performing transform and quantization on the residual block of the current block. The entropy encoding unit 155 can obtain the generated transform coefficient of the current block.
[0152] The entropy encoding unit 155 can determine information about the transform coefficients of the current block, scan the information about the transform coefficients of the current block in a predetermined scan order to generate one-dimensional arrangement information about the transform coefficients of the current block, and perform entropy encoding on the one-dimensional arrangement information. The predetermined scan order can be an order according to inverse zigzag scanning or an order according to inverse diagonal scanning. However, it is not limited thereto, and can be various scan orders such as an order according to inverse horizontal scanning and an order according to inverse vertical scanning. The predetermined scan order can be determined based on at least one of a horizontal direction coordinate value of an effective transform coefficient pixel located at a rightmost side within the current block and a vertical direction coordinate value of an effective transform coefficient pixel located at a lowermost side within the current block. The entropy encoding unit 155 can determine the predetermined scan order based on the size of the horizontal direction coordinate value and the size of the vertical direction coordinate value. For example, when the horizontal direction coordinate value is greater than the vertical direction coordinate value, the entropy encoding unit 155 can determine an inverse vertical scanning order as the predetermined scan order. When the vertical direction coordinate value is greater than the horizontal direction coordinate value, the entropy encoding unit 155 can determine an inverse horizontal scanning order as the predetermined scan order.
[0153] Alternatively, when the horizontal direction coordinate value is greater than the vertical direction coordinate value, the entropy encoding unit 155 can determine an inverse vertical first zigzag scan order as the predetermined scan order. When the vertical direction coordinate value is greater than the horizontal direction coordinate value, the entropy encoding unit 155 can determine an inverse horizontal first zigzag scan order as the predetermined scan order. When the vertical direction coordinate value is the same as the horizontal direction coordinate value, the entropy encoding unit 155 can determine one of an inverse vertical first zigzag scan order and an inverse horizontal first zigzag scan order as the predetermined scan order.
[0154] Alternatively, when the horizontal direction coordinate value is greater than the vertical direction coordinate value, the entropy encoding unit 155 can determine an inverse horizontal first zigzag scan order as the predetermined scan order. When the horizontal direction coordinate value is not greater than the vertical direction coordinate value, the entropy encoding unit 155 can determine an inverse horizontal first zigzag scan order as the predetermined scan order.
[0155] First, the entropy encoding unit 155 can determine a quad scan region including all of the significant transform coefficients within the current block. At this time, all of the significant transform coefficients within the current block can be included in the quad scan region, and the remaining region within the current block other than the quad scan region can include only transform coefficients having a value of 0 that are not significant transform coefficients. The entropy encoding unit 155 can determine coordinates specifying the quad scan region and entropy-encode information about the coordinates specifying the quad scan region. In other words, the entropy encoding unit 155 can perform binarization based on a predetermined binarization method on a syntax element about the coordinates specifying the quad scan region to generate a bin string. Here, the predetermined binarization method can be at least one of a fixed length binarization method or a truncated unary binarization method.
[0156] The entropy encoding unit 155 can perform context-based binarization arithmetic encoding on the bin string about the syntax element about the coordinates specifying the quad scan region. At this time, the context model can be determined based on at least one of a size of the current block, a color component of the current block, and a bin index. The color component can include a luma component and a chroma component. The bin index can be information indicating a position of a bin currently being binarization arithmetic encoded in the bin string about the syntax element.
[0157] The entropy encoding unit 155 can generate entropy-encoded information by performing at least one of binarization and context-based binarization arithmetic encoding on the scanned information about the transform coefficient.
[0158] When the first information about the transform coefficient is information indicating whether an absolute value of the current transform coefficient is greater than 1, the remaining level absolute value information, and the sign information of the current transform coefficient, and the second information about the transform coefficient is the binarization parameter information, the entropy encoding unit 155 can perform binarization based on the second information on the first information about the transform coefficient to generate a bin string about the first information. The entropy encoding unit 155 can perform binarization arithmetic encoding on the bin string about the first information to generate entropy-encoded information.
[0159] The second information can be determined based on at least one of information about at least one second transform coefficient previously scanned according to a predetermined scan order, a position of the first transform coefficient within the current block, a color component, information about a surrounding transform coefficient of a right side or a lower side, and a scan position of the first transform coefficient. For example, the binarization parameter information about the first transform coefficient can be determined based on a level absolute value of a surrounding significant transform coefficient of a right side or a lower side of the first transform coefficient. The binarization parameter information about the first transform coefficient can be determined based on a sum of level absolute values of surrounding significant transform coefficients of a right side or a lower side of the first transform coefficient.
[0160] Alternatively, the binarization parameter information about the first transform coefficient can be determined based on at least one of levels of n (n is an integer) transform coefficients previously scanned according to a predetermined scan order, a position of the first transform coefficient within the current block, a color component, and levels of n (n is a positive integer) transform coefficients adjacent to a right side or a lower side, whether the first transform coefficient is a transform coefficient at an initial position within a scan region in a scan order, whether the first transform coefficient is a transform coefficient at a final position within the scan region in the scan order, and whether the first transform coefficient is a coefficient at a first position within a coefficient group in the scan order.
[0161] When the information about the transform coefficient is information indicating whether an 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 encoding unit 155 can perform binarization on the information about the transform coefficient to generate a bin string. The entropy encoding unit 155 can generate binarized arithmetic coded information by performing binarized arithmetic coding on the bin string based on a context model about the transform coefficient. The context model about the first transform coefficient can be determined based on at least one of information about at least one second transform coefficient previously scanned according to a predetermined scan order, a position of the first transform coefficient within the current block, a color component, information about a surrounding transform coefficient of a right side or a lower side, and a scan position of the first transform coefficient.
[0162] The context model about the flag information indicating whether the first transform coefficient is greater than 0 can be determined based on a number of significant transform coefficients of a right side or a lower side having an absolute value greater than 0.
[0163] However, not limited thereto, 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 significant transform coefficients having an absolute value greater than 0 among n (n is a positive integer) transform coefficients previously scanned in the predetermined scan order.
[0164] The context model related to the flag information indicating that the first transform coefficient is greater than 1 can be determined based on the number of significant transform coefficients having an absolute value greater than 1 on the right side or the lower side.
[0165] However, not limited thereto, 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 significant transform coefficients having an absolute value greater than 1 among n (n is a positive integer) transform coefficients previously scanned in the predetermined scan order.
[0166] The context model related to the flag information indicating that the first transform coefficient is greater than 2 can be determined based on the number of significant transform coefficients having an absolute value greater than 2 on the right side or the lower side.
[0167] However, not limited thereto, 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 significant transform coefficients having an absolute value greater than 2 among n (n is a positive integer) transform coefficients previously scanned in the predetermined scan order.
[0168] When the position of the transform coefficient currently scanned in the scan region is [SRx, 0] (SRx is an integer, and SRx indicates a horizontal direction coordinate value of a pixel at the right side boundary of the scan region with the coordinate of the upper left corner of the scan region as a reference), and the transform coefficient previously scanned in the [SRx, Y] (Y is an integer greater than 0 and less than or equal to SRy, and SRy indicates a vertical direction coordinate value of a pixel at the lower side boundary of the scan region with the coordinate of the upper left corner of the scan region as a reference) position in the predetermined scan order is all 0 coefficients, the entropy encoding unit 155 can not generate the GT0 flag information of the transform coefficient currently scanned.
[0169] Similarly, when the position of the transform coefficient currently scanned in the scan region is [0, SRy] (SRy is an integer, and SRy indicates a vertical direction coordinate value of the lower side boundary of the scan region with the coordinate of the upper left corner of the scan region as a reference), and the transform coefficient previously scanned in the [X, SRy] (X is an integer greater than 0 and less than or equal to SRx, and SRx indicates a vertical direction coordinate value of a pixel at the right side boundary of the scan region with the coordinate of the upper left corner of the scan region as a reference) position in the predetermined scan order is all 0 coefficients, the entropy encoding unit 155 can not generate the GT0 flag information of the transform coefficient currently scanned.
[0170] In addition, the entropy encoding unit 155 can determine the maximum number of GT1 flag information of the effective transform coefficients within the current block, and generate the GT1 flag information within the current block within the determined maximum number of effective transform coefficients. In other words, the entropy encoding unit 155 can not generate the GT1 flag information of the effective transform coefficients any more after the entropy encoding unit 155 generates the GT1 flag information of the effective transform coefficients up to the maximum number.
[0171] The entropy encoding unit 155 can determine all of the effective transform coefficients that are not 0 as the maximum number of GT1 flag information within the current block. Alternatively, the entropy encoding unit 155 can determine the maximum number of GT1 flag information within the current block based on the size of the scan region. For example, the entropy encoding unit 155 can determine the maximum number of GT1 flag information MaxCount_GT1 based on Mathematical Formula 3 as follows.
[0172] [Mathematical Formula 3]
[0173]
[0174] At this time, sizeSR can indicate the size (width) of the quadrangular scan region, and sizeSR can be (Sr_x+1)*(Sr_y+1). Sr_x can indicate the horizontal direction coordinate of the rightmost effective transform coefficient pixel based on the coordinate of the left upper corner of the scan region. In other words, Sr_x can indicate the horizontal direction coordinate of the pixel at the right boundary based on the coordinate of the left upper corner of the scan region. Sr_y can indicate the vertical direction coordinate of the lowermost effective transform coefficient pixel based on the coordinate of the left upper corner of the scan region. In other words, Sr_y can indicate the vertical direction coordinate of the pixel at the lower boundary based on the coordinate of the left upper corner of the scan region. K1 can be a regulation coefficient between the size of the scan region and the GT1 flag. For example, K1 can be an integer greater than 1. Th1 can be a predetermined domain value. For example, Th1 can be 16, 8. However, it is not limited thereto, and a person of ordinary skill in the art should readily understand that K1 and Th1 can have various values.
[0175] The entropy encoding unit 155 can determine the maximum number of GT2 flag information within the current block, and generate the GT2 flag information within the current block within the determined maximum number of effective transform coefficients. In other words, the entropy encoding unit 155 can not generate the GT2 flag information of the effective transform coefficients any more after the entropy encoding unit 155 generates the GT2 flag information of the effective transform coefficients up to the maximum number.
[0176] The entropy encoding unit 155 can determine all the significant transform coefficients that are not 0 as the maximum number of GT2 flag information within the current block. Alternatively, the entropy encoding unit 155 can determine the maximum number of GT2 flag information within the current block based on the size of the scan region. For example, the entropy encoding unit 155 can determine the maximum number of GT2 flag information MaxCount_GT2 based on Mathematical Formula 4 as follows.
[0177] [Mathematical Formula 4]
[0178]
[0179] At this time, sizeSR can indicate the size (width) of the quadrilateral scan region, and sizeSR can be (Sr_x+1)*(Sr_y+1). Sr_x can indicate the horizontal direction coordinate of the rightmost significant transform coefficient pixel based on the coordinate of the left upper corner of the scan region. In other words, Sr_x can indicate the horizontal direction coordinate of the pixel at the right boundary based on the coordinate of the left upper corner of the scan region. Sr_y can indicate the vertical direction coordinate of the lowermost significant transform coefficient pixel based on the coordinate of the left upper corner of the scan region. In other words, Sr_y can indicate the vertical direction coordinate of the pixel at the lower boundary based on the coordinate of the left upper corner of the scan region. K2 can be a regulation coefficient between the size of the scan region and the GT2 flag. For example, K2 can be an integer greater than 1. Th2 can be a predetermined threshold value. For example, Th2 can be 16, 8. However, it is not limited thereto, and those skilled in the art will readily understand that K2 and Th2 can have various values.
[0180] The entropy encoding unit 155 can generate information about a coefficient group within the current block. The information about the coefficient group can be flag information indicating whether the coefficient group includes at least one significant transform coefficient. At this time, with respect to the transform coefficients included in the scan region, the entropy encoding unit 155 can determine one coefficient group from the transform coefficients of each predetermined K (K is an integer) that are scanned in a scan order. In other words, one coefficient group can include K transform coefficients. At this time, the scan order is a forward scan order in the opposite direction to a predetermined reverse scan order. Here, the predetermined reverse scan order can indicate an order in which scanning is performed from a coefficient located at the right lower end among the transform coefficients included in the current block to a coefficient located at the left upper end among the transform coefficients included in the current block.
[0181] Accordingly, the entropy encoding unit 155 determines the coefficient group by scanning in a forward scan order starting from a coefficient (i.e., a DC coefficient) adjacent to a top-left corner within the current block. At this time, when the number of transform coefficients included in the current block is not an integer multiple of K, a final coefficient group among the coefficient groups scanned in the forward scan order can include transform coefficients less than K in number. However, it is not limited thereto, and those skilled in the art will readily understand that the coefficient group can be determined by scanning in a reverse scan order scanning from a coefficient located at a right lower end among the transform coefficients included in the current block to a coefficient located at a left upper end among the transform coefficients included in the current block.
[0182] When one of the coefficient groups scanned in the predetermined scan order includes only one transform coefficient, the entropy encoding unit 155 can directly generate GT0 flag information without generating information about the coefficient group.
[0183] The entropy encoding 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 encoding unit 155 can determine to hide the sign of one or two transform coefficients for each coefficient group included in the current block depending on the situation.
[0184] The entropy encoding unit 155 can scan information about transform coefficients within the quadrangular scan region in a predetermined scan order. The predetermined scan order can include a reverse zigzag scan order, a reverse diagonal scan order, a reverse vertical scan order, and a horizontal scan order. However, those skilled in the art will readily understand that the predetermined scan order is not limited to the mentioned reverse scan orders but can include various reverse scan orders.
[0185] The bitstream generating unit 170 can generate a bitstream including the entropy-encoded information. In other words, the bitstream generating unit 170 can generate a bitstream including information entropy-encoded by the entropy encoding unit 155 scanning information about transform coefficients and based on the scanned information about transform coefficients.
[0186] The bitstream generation unit 170 can generate a bitstream that includes information related to a specified quadrilateral scan region, where the quadrilateral scan is the region used to scan information related to transform coefficients. In this case, the information related to the coordinates of the specified quadrilateral scan region can include information indicating the horizontal coordinate value of the rightmost valid transform coefficient pixel included in the current block and the vertical coordinate value of the bottommost valid transform coefficient pixel included in the current block. However, it is not limited to this; the information related to the coordinates of the specified quadrilateral scan region can include information indicating the larger coordinate value between the horizontal coordinate value of the rightmost valid transform coefficient pixel included in the current block and the vertical coordinate value of the bottommost valid transform coefficient pixel included in the current block. In other words, the bitstream generation unit 170 may determine a square scan region based on the larger value of the horizontal coordinate value of the rightmost valid transform coefficient pixel and the vertical coordinate value of the bottommost valid transform coefficient pixel included in the current block, even if they are not mutually exclusive. At this point, a square scanning area larger than the rectangular scanning area can be determined. However, the video encoding device 150 can reduce the number of bits when transmitting the signal by transmitting only information indicating a coordinate value in one direction.
[0187] The video encoding apparatus 150 may include an image encoding unit (not shown), which may include an entropy encoding unit 155 and a bitstream generation unit 170. (Reference) Figure 1 f The image coding unit is described.
[0188] Figure 1 d The diagram illustrates a flowchart of a video encoding method according to various embodiments.
[0189] refer to Figure 1 d In step S150, the video encoding device 150 can obtain the transform coefficients of the current block. The current block can be a reference block. Figures 10 to 23 The data units described are the data units that can be used in the process of encoding / decoding an image.
[0190] The video coding apparatus 150 can generate a prediction block for the current block by performing inter-frame prediction or intra-frame prediction, and can generate a residual block for the current block based on the original block and the prediction block. The video coding apparatus 150 can perform transform and quantization on the residual block of the current block to generate transform coefficients for the current block.
[0191] In step S155, the video encoding apparatus 150 can determine a quadrilateral scan region including all the significant transform coefficients within the current block. At this time, all the significant transform coefficients within the current block can be included within the quadrilateral scan region, and other regions within the current block other than the quadrilateral scan region can include only coefficients having a value of 0 which are not significant transform coefficients. The video encoding apparatus 150 can determine coordinates specifying the quadrilateral scan region, and entropy-encode information about the coordinates specifying the quadrilateral scan region. In other words, the video encoding apparatus 150 can perform binarization based on a predetermined binarization method on a syntax element about the coordinates specifying the quadrilateral scan region to generate a bin string. Here, the predetermined binarization method can be at least one of a fixed length binarization method or a truncated unary binarization method. The video encoding apparatus 150 can perform context-based binarization arithmetic encoding on the bin string about the syntax element about the coordinates specifying the quadrilateral scan region. At this time, the context model can be determined based on at least one of a size of the current block, a color component of the current block, and a bin index.
[0192] In step S160, the video decoding apparatus 150 can scan information about transform coefficients included in the quadrilateral scan region in a predetermined scan order. The information about the transform coefficients can include flag information indicating whether the transform coefficients are greater than a predetermined value. At this time, the predetermined value can be at least one of 0, 1, and 2. At least one of residual level absolute value information of the transform coefficients, sign information of the transform information, and binarization parameter information can be included. The binarization parameter can include at least one of a Rice parameter and various binarization parameters. The predetermined scan order can include an inverse zigzag scan order, an inverse diagonal scan order, an inverse vertical scan order, and a horizontal scan order. However, it would be readily understood by those skilled in the art that the predetermined scan order is not limited to the mentioned inverse scan orders but can include various inverse scan orders.
[0193] In step S165, the video encoding apparatus 150 can generate entropy-encoded information based on the scanned information about the transform coefficient. The video encoding apparatus 150 can generate the entropy-encoded information based on at least one of binarization and context model-based binarization arithmetic encoding performed on the scanned information about the transform coefficient. When the first information about the transform coefficient is information indicating that an absolute value of the current transform coefficient is greater than a predetermined value, a remaining level absolute value information, and a sign information of the current transform coefficient, and the second information about the significant transform coefficient is binarization parameter information, the video encoding apparatus 150 can generate a bin string about the first information by performing binarization on the first information based on the second information. The video encoding apparatus 150 can generate the entropy-encoded information by performing binarization arithmetic encoding on the bin string about the first information.
[0194] The second information can be determined based on at least one of information about at least one second transform coefficient previously scanned in the predetermined scan order, a position of the first transform coefficient within the current block, and a color component, information about a surrounding transform coefficient of a right side or a lower side of the first transform coefficient, and a scan position of the first transform coefficient. The binarization parameter information about the first transform coefficient can be determined based on level absolute values of surrounding significant transform coefficients of a right side or a lower side of the first transform coefficient. For example, the binarization parameter information about the first transform coefficient can be determined based on a sum of the level absolute values of the surrounding significant transform coefficients of the right side or the lower side of the first transform coefficient.
[0195] When the information about the transform coefficient is information indicating whether an absolute value of the current significant transform coefficient is greater than a predetermined value, a remaining level absolute value information, and a sign information of the current significant transform coefficient, the video encoding apparatus 150 can generate a bin string by performing binarization on the information about the transform coefficient. The video encoding apparatus 150 can generate binarization arithmetic encoded information by performing binarization arithmetic encoding on the bin string based on a context model about the significant transform coefficient. In the context model about the significant transform coefficient, a context model about the first transform coefficient is determined based on at least one of information about at least one second transform coefficient previously scanned in the predetermined scan order, a position of the first transform coefficient within the current block, and a color component, information about a surrounding transform coefficient of a right side or a lower side of the first transform coefficient, and a scan position of the first transform coefficient.
[0196] In step S170, the video encoding apparatus 150 can generate a bitstream including the entropy-encoded information. The video encoding apparatus 150 can generate a bitstream including information related to the transform coefficients scanned by the entropy encoding unit 155 and entropy-encoded based on the scanned information related to the transform coefficients.
[0197] Also, the video encoding apparatus 150 can generate a bitstream including information related to coordinates specifying a quadrangular scanning region, which is a region for scanning information related to the transform coefficients.
[0198] Figure 1 e A block diagram illustrating an image decoding unit 6000 according to various embodiments is shown.
[0199] The image decoding unit 6000 according to various embodiments performs operations undergone when image data is encoded by an image decoding unit (not shown) of the video decoding apparatus 100.
[0200] Reference Figure 1 e The entropy decoding unit 6150 parses, from the bitstream 6050, encoded image data that is a decoding target and encoding information required for decoding. The encoded image data is quantized transform coefficients, and the inverse quantization unit 6200 and the inverse transform unit 6250 restore residual data from the quantized transform coefficients. Figure 1 e The entropy decoding unit 6150 of the video decoding apparatus 1000 can correspond to the entropy decoding unit 105 of the video encoding apparatus 100. Figure 1 a The entropy decoding unit 6150 of the video decoding apparatus 1000 can correspond to the entropy decoding unit 105 of the video encoding apparatus 100.
[0201] The intra prediction unit 6400 performs intra prediction in blocks. The inter prediction unit 6350 performs inter prediction in blocks using reference images obtained from the restored picture buffer 6300. The deblocking unit 6450 and the SAO execution unit 6500 can perform loop filtering on the restored spatial domain data of the blocks of the current image 6050 by adding the prediction data and the residual data of each block generated by the intra prediction unit 6400 or the inter prediction unit 6350 to output the filtered restored image 6600. Also, the restored image stored in the restored picture buffer 6300 can be output as a reference image.
[0202] To decode image data by a decoding unit (not shown) of the video decoding apparatus 100, the operations of the image decoding unit 6000 according to various embodiments in each step can be performed in blocks.
[0203] Figure 1 f A block diagram illustrating an image encoding unit according to various embodiments is shown.
[0204] The image encoding unit 7000 according to various embodiments performs operations that are performed when encoding image data by the image encoding unit (not shown) of the video encoding apparatus 150.
[0205] In other words, the intra prediction unit 7200 performs intra prediction on the current image 7050 by block, and the inter prediction unit 7150 performs inter prediction using the current image 7050 and the reference image obtained from the restored picture buffer 7100 by block.
[0206] 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 block for the current image 7050, and the transform unit 7250 and the quantization unit 7300 can output quantized transform coefficients by block by performing transform and quantization on the residual data. The inverse quantization unit 7450 and the inverse transform unit 7500 can restore the residual data in the spatial domain by performing inverse quantization and inverse transform on the quantized transform coefficients. The restored residual data in the spatial domain is added to the prediction data for each block output from the intra prediction unit 7200 or the inter prediction unit 7200 to be restored as data in the spatial domain for the block of the current image 7050. The deblocking unit 7550 and the SAO execution unit generate a filtered restored image by performing loop filtering on the restored data in the spatial domain. The generated restored image is stored in the restored picture buffer 7100. The restored image stored in the restored picture buffer 7100 can be used as a reference image for inter prediction of other images. The entropy encoding unit 7350 can entropy-encode the quantized transform coefficients, and the entropy-encoded coefficients can be output as a bitstream 7400. Figure 1 f The entropy encoding unit 7350 of the image encoding unit 7000 according to various embodiments can correspond to the entropy encoding unit 155 of the video encoding apparatus 150. Figure 1 c
[0207] The operations of each step of the image encoding unit 7000 according to various embodiments can be performed by block to apply the image encoding unit 7000 according to various embodiments to the video encoding apparatus 150.
[0208] Hereinafter, a method of scanning transform coefficients within a current block for a current picture is described with the assumption that '0' and '1' shown for pixels within the current block of Figure 2 , Figures 3a to 3b are values of valid transform coefficient flags (flags indicating whether the absolute values of the coefficients are greater than 0).
[0209] Figure 2 is a diagram for explaining a method of scanning transform coefficients within a block according to an embodiment.
[0210] Referring to Figure 2 The current block 200 is a block including a plurality of transform coefficients. The current block 200 is a unit of data on which an inverse transform operation is performed and can be a block having an M x N (M, N are positive integers) size. For example, as shown in FIG. 2A, the current block 200 can be a block having a 16 x 16 size. Figure 2
[0211] The video decoding apparatus 100 can divide the current block 200 into coefficient groups (or sub-blocks) 205 having a predetermined size. The coefficient group can be a block having an X x Y (X, Y are positive integers) size. For example, as shown in FIG. 2B, the coefficient group 205 can be a block having a 4 x 4 size. Figure 2
[0212] The video decoding apparatus 100 can obtain, from the bitstream, information about a coordinate of a pixel 210 of a final significant transform coefficient among all significant transform coefficients scanned in a process of scanning the transform coefficients of the current block 200 from a left upper end transform coefficient to a right lower end transform coefficient in a forward scanning order. The information about the coordinate of the pixel 210 of the final significant transform coefficient can include information about a horizontal direction coordinate of the pixel of the final significant transform coefficient and information about a vertical direction coordinate of the pixel of the final significant transform coefficient.
[0213] The video decoding apparatus 100 can obtain the coordinate of the pixel 210 of the final significant transform coefficient based on the information about the coordinate of the pixel 210 of the final significant transform coefficient and scan information of the transform coefficients in a predetermined reverse scanning order 215 starting from the final significant transform coefficient 210 based on the coordinate of the pixel 210 of the final significant transform coefficient. For example, as shown in FIG. 2C, the predetermined reverse scanning order 215 can be a reverse diagonal scanning order. Figure 2
[0214] The video decoding apparatus 100 can perform scanning on the coefficient groups 205 in the predetermined scanning order and perform scanning on each of the coefficient groups 205 in the predetermined scanning order. On the coefficient group, the video decoding apparatus 100 can scan information about the coefficient group in the predetermined scanning order. The information about the coefficient group can be obtained or derived from the bitstream. The information about the coefficient group can be derived to indicate that the first coefficient group and the last coefficient group scanned in the forward (reverse) scanning order include at least one significant transform coefficient. In other words, the information about the coefficient group can not be included in the bitstream for the first coefficient group and the last coefficient group scanned in the forward (reverse) scanning order.
[0215] At this time, the video decoding apparatus 100 can determine the predetermined inverse scanning order based on at least one of the size of the block and the prediction mode. For example, when the size of the current block is 4x4 and the prediction mode of the current block is the intra prediction mode, the video decoding apparatus 100 can determine one of the inverse horizontal scanning order, the inverse vertical scanning order, or the inverse diagonal scanning order as the predetermined inverse scanning order. Also, when the size of the current block is 8x8 and the prediction mode of the current block is the intra prediction mode, the video decoding apparatus 100 can determine one of the inverse horizontal scanning order, the inverse vertical scanning order, or the inverse diagonal scanning order as the predetermined inverse scanning order.
[0216] When the size of the current block is not 4x4 or 8x8 or the prediction mode of the current block is not the inter prediction mode, the video decoding apparatus 100 can determine the inverse diagonal scanning order as the predetermined inverse scanning order.
[0217] When the information related to the coefficient group 205 indicates that at least one significant coefficient is included in the coefficient group 205, the video decoding apparatus 100 can scan the information related to the transform coefficients within the coefficient group 205 in the inverse predetermined scanning order.
[0218] The video decoding apparatus 100 can determine a sign of at least one of the significant transform coefficients included in each of the coefficient groups 205.
[0219] Figure 3a A diagram for explaining a method of scanning transform coefficients within a block according to another embodiment.
[0220] Referring to Figure 3a , the current block 300 is a block including a plurality of transform coefficients. The current block 300 is a unit of data on which an inverse transform operation is performed, and can be a block having an MxN (M and N are positive integers) size. For example, as shown in Figure 3a , the current block 300 can be a block having a 16x16 size.
[0221] Referring to Figure 3aThe video decoding apparatus 100 can determine the quadrilateral scan region 340 including all the significant transform coefficients existing in the current block 300. At this time, the quadrilateral scan region 340 can be determined based on the coordinates of the pixel 330 located at the right lower end of the quadrilateral scan region 340. The horizontal direction coordinates of the pixel 330 located at the right lower end of the scan region 340 can be the horizontal direction coordinates of the pixel 320 located at the rightmost side among all the significant transform coefficients within the current block 300. The vertical direction coordinates of the pixel 330 located at the right lower end of the scan region 340 can be the vertical direction coordinates of the pixel 310 located at the lowermost side among all the significant transform coefficients within the current block 300. The information related to the pixel 330 can include information related to the position of the left upper end corner of the pixel 330. However, it is not limited thereto, and the information related to the pixel 330 can include information related to the position of the right lower end corner of the pixel 330.
[0222] The video decoding apparatus 100 can receive information related to the coordinates of the pixel 330 specifying the quadrilateral scan region 340 from the bitstream, and can determine the quadrilateral scan region 340 based on the received information related to the pixel 330. The video decoding apparatus 100 can scan the information related to the transform coefficients in the predetermined inverse scan order 305 from the pixel 330 to the pixel 345 at the left upper end of the quadrilateral scan region 340. At this time, the coefficient group can be determined from every K (K is a positive integer) scan coefficients scanned in the predetermined forward scan order from the transform coefficient at the left upper end of the quadrilateral scan region. However, it is not limited thereto, and can be determined from every K (K is a positive integer) scan coefficients scanned in the predetermined inverse scan order from the transform coefficient at the right lower end, which is easily understood by those skilled in the art. Details related to the coefficient group will be described later with reference to FIG. 4. Figure 3b Details related to the coefficient group will be described later with reference to FIG. 4.
[0223] The video decoding apparatus 100 can determine the sign (Sign) for at least one significant transform coefficient hidden for each coefficient group, and can restore the hidden sign for at least one significant transform coefficient. Details related to the operation of restoring the hidden sign for each coefficient group will be described later with reference to FIG. 5. Figure 3b Details related to the operation of restoring the hidden sign for each coefficient group will be described later with reference to FIG. 5.
[0224] Figure 3b A diagram for explaining the operation of determining the coefficient group (sub-block) within the block according to another embodiment and the operation performed in the coefficient group.
[0225] The video decoding apparatus 100 can determine the coefficient group of K (K is a positive integer) transform coefficient pixels in the current block 350 in the predetermined scan order 355 in the forward direction. The video decoding apparatus 100 can determine the coefficient group including K transform coefficient pixels. For example, as shown in FIG. 3B, the video decoding apparatus 100 can determine the coefficient group 360 of 16 pixels. Figure 3b
[0226] The video decoding apparatus 100 can determine that the sign (Sign) for at least one significant transform coefficient is hidden in each of the coefficient groups 360, and can determine that the sign (Sign) for at least one significant transform coefficient is hidden in each of the coefficient groups 360. For example, the video decoding apparatus 100 can determine that the sign for at least one significant transform coefficient is hidden in the current coefficient group based on a distance between the previously decoded significant transform coefficients in the current coefficient group. Specifically, the video decoding apparatus 100 can determine that the sign for at least one significant transform coefficient is hidden in the current coefficient group based on a distance between the first significant transform coefficient and the last significant transform coefficient scanned in the predetermined inverse scan order. At this time, the distance can be a difference between positions of the coefficients scanned in the inverse scan order.
[0227] For example, when the distance between the first significant transform coefficient and the last significant transform coefficient scanned in the predetermined inverse scan order is greater than a predetermined value, the video decoding apparatus 100 can determine that the sign for at least one significant transform coefficient is hidden in the current coefficient group. At this time, the predetermined value can be various integer values. For example, the predetermined value can be 3.
[0228] When the video decoding apparatus 100 determines that the sign for at least one significant transform coefficient is hidden in the current coefficient group, the video decoding apparatus 100 restores the sign hidden for at least one significant transform coefficient in the current coefficient group without obtaining information about the sign from the bitstream for the current coefficient group. For example, when a parity sum of levels for the significant transform coefficients in the current coefficient group is odd or even, the video decoding apparatus 100 can determine the sign for at least one significant transform coefficient as 0 or 1. At this time, the restored sign of the significant transform coefficient can include the sign for the last significant transform coefficient scanned in the inverse scan order. However, it is not limited thereto, and those of ordinary skill in the art can easily understand that the sign in a predetermined position in the coefficient group can be restored in the predetermined scan order.
[0229] The video decoding device 100 can obtain information related to a corresponding coefficient group from the bitstream in the inverse predetermined scan order, and when the information related to the corresponding coefficient group indicates that at least one transform coefficient is included in the coefficient group, the video decoding device 100 can scan information related to the transform coefficients within the corresponding coefficient group. When the information related to the corresponding coefficient group indicates that only transform coefficients having a value of 0 are included in the coefficient group, the transform coefficients within the corresponding coefficient group can all be determined to be 0.
[0230] When the number of transform coefficients included in the quadrilateral scan region within the current block 300 is not an integer multiple of K, there can be a number of transform coefficient pixels less than K in determining the last coefficient group in the forward scan order. At this time, the video decoding device 100 can determine a coefficient group 365 including a number of transform coefficient pixels less than K. For example, as shown in FIG. 4B, the video decoding device 100 can determine a coefficient group 365 including two transform coefficients. Figure 3b
[0231] The video decoding device 100 can obtain information related to the coefficient groups 355 and 360 from the bitstream. Here, the information related to the coefficient groups 355 and 360 can be flag information (significant coefficient group flag information) indicating whether at least one of the transform coefficients included in the coefficient groups 355 and 360 is a significant transform coefficient or the coefficient groups 355 and 360 include only 0 transform coefficients.
[0232] When a coefficient group including only one transform coefficient is determined, the video decoding device 100 can obtain only information related to one transform coefficient from the bitstream, without obtaining information (e.g., significant coefficient group flag information) related to the coefficient group.
[0233] The video decoding device 100 can determine a context model for binararily arithmetically decoding information related to a current coefficient group based on coefficient group information of a coefficient group scanned before the current coefficient group in the inverse predetermined scan order 355.
[0234] Figure 4 A diagram for explaining a process of determining a context model for context-based binarily arithmetically encoding information related to a transform coefficient according to an embodiment.
[0235] Referring to FIG. 4A, Figure 4 , the video decoding device 100 can determine a context model of information related to a currently scanned transform coefficient pixel 405 based on surrounding transform coefficient pixels 410. In Figure 4 In this case, the surrounding transform coefficient pixels 405 can be five pixels present at predetermined positions to the right or below the currently scanned transform coefficient pixel 405. However, this is not limiting, and it would be readily understood by those skilled in the art that the surrounding transform coefficient pixels 405 can be n (n is a positive integer) pixels at predetermined positions to the right or below.
[0236] For example, the video decoding apparatus 100 can determine a context model of flag information indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than 0, based on the number of coefficient pixels having a level absolute value greater than 0 among the surrounding transform coefficient pixels 410.
[0237] Also, the video decoding apparatus 100 can determine a context model of flag information indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than 1, based on the number of coefficient pixels having an absolute value greater than 1 among the surrounding transform coefficient pixels 410.
[0238] The video decoding apparatus 100 can determine a context model of flag information indicating whether the level absolute value of the currently scanned transform coefficient pixel 405 is greater than 2, based on the number of coefficient pixels having an absolute value greater than 2 among the surrounding transform coefficient pixels 410.
[0239] The video decoding apparatus 100 can determine a context model of flag information indicating whether the level value of the currently scanned transform coefficient pixel 405 is greater than N (N is an integer greater than 2), based on the number of coefficient pixels having an absolute value greater than N among the surrounding transform coefficient pixels 410.
[0240] The video decoding apparatus 100 can determine a parameter for binarizing the remaining level absolute value of the currently scanned transform coefficient pixel 405, based on the sum of the level absolute values of the surrounding transform coefficient pixels 410. At this time, the binarization parameter can be a Rice parameter.
[0241] Figure 5 A diagram for explaining a process of determining a context model for context-based binarization arithmetic coding of information about a transform coefficient according to an embodiment.
[0242] Referring to Figure 5 The video decoding apparatus 100 can determine a context model of information about the currently scanned transform coefficient pixel 505, based on a transform coefficient pixel 510 previously scanned in a predetermined inverse scanning order 515. As described above, the inverse scanning order 515 can be a scanning order in which transform coefficient pixels are scanned in a zigzag manner. Figure 5As shown, the transform coefficient pixel 510 can be one of the five pixels scanned before the currently scanned transform coefficient pixel 505 according to a predetermined reverse scanning order 515. However, it is not limited to this, and those skilled in the art will readily understand that the transform coefficient pixel 505 can be one of the n (n is a positive integer) pixels previously scanned according to the predetermined reverse scanning order 515. Figure 5 As shown, the predetermined reverse scanning sequence 515 can be a reverse zigzag scanning sequence; however, it is not limited to this and can include a horizontal scanning sequence, a vertical scanning sequence, a diagonal scanning sequence, etc., which is readily understood by those skilled in the art. In particular, 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 a specific scanning area.
[0243] For example, the video decoding device 100 can determine a context model of flag information indicating whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than 0 based on the number of coefficient pixels with absolute values greater than 0 in the surrounding transform coefficient pixels 510.
[0244] Furthermore, the video decoding device 100 can determine a context model of flag information indicating whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than 1 based on the number of coefficient pixels in the transform coefficient pixel 510 with an absolute value greater than 1.
[0245] 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 absolute value is greater than 2, indicating whether the level absolute value of the currently scanned transform coefficient pixel 505 is greater than 2.
[0246] 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 absolute value is greater than N, indicating whether the level absolute value of the currently passed transform coefficient pixel 505 is greater than N (N is an integer greater than 2).
[0247] The video decoding device 100 can determine parameters for binarizing the remaining level absolute values of the currently scanned transform coefficient pixel 505 based on the sum of the absolute value levels of the surrounding transform coefficient pixels 510. In this case, the binarization parameters can be Ricean parameters.
[0248] Figure 6a This diagram illustrates a zigzag scanning sequence for scanning information related to the effective transformation coefficients within a block, according to one embodiment.
[0249] refer to Figure 6aIn accordance with the zigzag scan order 605, the video decoding device 100 can scan from the transform coefficient pixel at the lower right end of the current block 600 to the transform coefficient pixel at the upper left end of the current block 600 to scan information related to the transform coefficients of the current block 600.
[0250] In particular, in accordance with the zigzag scan order 605, the video decoding device 100 scans the pixel 610 at the lower right end, then scans the pixel 615 to the left of the pixel 610, and then scans the pixel 620 diagonally to the right upper end. The video decoding device 100 scans the pixel 625 to the upper side of the pixel 620. The video decoding device 100 scans the pixel 630 diagonally to the lower left end of the pixel. The video decoding device 100 scans the pixel 635 to the left of the pixel in the lower left end of the pixel 630 that is adjacent to the boundary of the current block 600. In a similar manner, the video decoding device 100 can scan information related to the remaining transform coefficient pixels in accordance with the zigzag scan order 605.
[0251] In addition, in the zigzag scan order 605 in accordance with an embodiment, the pixel 615 to the left direction in a direct horizontal direction is scanned after the pixel 610 is scanned, and thus the zigzag scan order 605 can be referred to as a horizontal-first zigzag order.
[0252] Figure 6b A diagram for illustrating a zigzag scan order for scanning information related to transform coefficients within a block in accordance with another embodiment.
[0253] Reference Figure 6b In accordance with the zigzag scan order 635, the video decoding device 100 can scan from the transform coefficient pixel at the lower right end of the current block 600 to the transform coefficient pixel at the upper left end of the current block 600 to scan information related to the transform coefficients of the current block 600.
[0254] In particular, in accordance with the zigzag scan order 635, the video decoding device 100 scans the pixel 645 at the lower right end, then scans the pixel 650 to the upper side of the pixel 645, and then scans the pixel 655 diagonally to the lower left end. The video decoding device 100 scans the pixel 660 to the left of the pixel 655. The video decoding device 100 scans the pixel 665 diagonally to the right upper end of the pixel. The video decoding device 100 scans the pixel 670 to the upper side of the pixel in the pixel 665 that is adjacent to the boundary of the current block 600. In a similar manner, the video decoding device 100 can scan information related to the remaining transform coefficient pixels in accordance with the zigzag scan order 605.
[0255] In zigzag scan order 605 according to an embodiment, after scanning pixel 645, pixel 650 located in the directly vertical direction is scanned, thus zigzag scan order 605 can be referred to as vertical-first zigzag order.
[0256] Figure 7a FIG. 6 is a diagram for explaining a horizontal scan order according to an embodiment of scanning information related to transform coefficients within a block.
[0257] Referring to FIG. 7, Figure 7a According to horizontal scan order 705, video decoding apparatus 100 scans transform coefficient pixels from the right lower end of current block 700 to the left upper end, to scan information related to transform coefficients of current block 700.
[0258] Specifically, according to horizontal scan order 705, after scanning transform coefficient pixel 710 at the right lower end, video decoding apparatus 100 scans pixel 715 located in the horizontal direction (i.e., left direction) in turn, and after scanning a pixel in pixel 715 adjacent to the left boundary of current block 700, scans the rightmost pixel 720 of the row directly above it. Video decoding apparatus 100 scans pixel 725 located in the horizontal direction (i.e., left direction) in the same way as the way of scanning pixel 715 of the previous row. In a similar manner, video decoding apparatus 100 can scan information related to the remaining transform coefficient pixels according to horizontal scan order 705.
[0259] Figure 7b FIG. 8 is a diagram for explaining a vertical scan order according to an embodiment of scanning information related to transform coefficients within a block.
[0260] Referring to FIG. 8, Figure 7b According to vertical scan order 730, video decoding apparatus 100 scans transform coefficient pixels from the right lower end of current block 700 to the left upper end, to scan information related to transform coefficients of current block 700.
[0261] In particular, according to the vertical scan order 730, the video decoding device 100 scans the pixels 740 located vertically (i.e., above) to the right lower end transform coefficient pixel 735 after scanning the right lower end transform coefficient pixel 735, and scans the lowermost pixel 745 of the column directly left to the pixels 740 after scanning the pixels 740 adjacent to the upper side boundary of the current block 700. The video decoding device 100 scans the pixels 750 located vertically (i.e., above) to the pixels 740 in the same manner as scanning the pixels 740 of the previous column. In a similar manner, the video decoding device 100 can scan the information related to the remaining transform coefficient pixels in the vertical scan order 730.
[0262] Figure 8 FIG. 4 is a diagram for illustrating a diagonal scan order according to an embodiment for scanning information related to transform coefficients within a block.
[0263] Referring to Figure 8 , the video decoding device 100 can scan from the right lower end transform coefficient pixel of the current block 800 to the left upper end transform coefficient pixel in the diagonal scan order 805 to scan the information related to the transform coefficients of the current block 800.
[0264] In particular, according to the diagonal scan order 805, the video decoding device 800 scans the upper side pixel 815 of the right lower end transform coefficient pixel 810 after scanning the right lower end transform coefficient pixel 810, and scans the pixel 820 located diagonally to the left lower end after scanning the upper side pixel 815. The video decoding device 100 scans the pixel 825 adjacent to the upper side of the pixel 815. The video decoding device 100 scans the pixel 830 located diagonally to the left lower end of the pixel 825. In a similar manner, the video decoding device 100 can scan the information related to the remaining transform coefficient pixels in the diagonal scan order.
[0265] The above describes various scan orders for scanning information related to significant transform coefficients within a block with reference to Figures 6a to 8 The scan order described with reference to Figures 6a to 8 is a reverse scan order, but is not limited thereto, and a person skilled in the art can easily understand a forward scan order that scans in an order opposite to the reverse scan order.
[0266] Figures 9a to 9c FIG. 6 is a diagram for illustrating a residual coding syntax structure according to an embodiment.
[0267] Referring to Figures 9a to 9bThe video decoding apparatus 100 scans syntax element information related to the transform coefficients, decodes the transform coefficients based on the scanned syntax element information, to restore the transform coefficients.
[0268] First, the video decoding apparatus 100 can obtain syntax element information scan_region_x and scan_region_y indicating coordinates of a specified quadrilateral scan region from a bitstream. At this time, the syntax element information scan_region_x can indicate a horizontal direction (x-axis direction) coordinate value of an effective transform coefficient located at the rightmost side within the current block based on a coordinate of the upper left corner of the current block, and the syntax element information scan_region_y can indicate a vertical direction (y-axis direction) coordinate value of an effective transform coefficient located at the lowermost side within the current block based on the coordinate of the upper left corner of the current block. The video decoding apparatus 100 can determine coordinates srX and srY of the specified scan region based on the syntax element information scan_region_x and scan_region_y.
[0269] The video decoding apparatus 100 can determine a scan order position of a transform coefficient within the scan region determined according to the scan order (Scan Order (srx+1, srY+1)) based on the coordinates srX and srY of the specified scan region.
[0270] The video decoding apparatus 100 can determine index information lastSet indicating a coefficient group last scanned in the forward scan order based on the coordinates srX and srY of the specified scan region. In other words, the video decoding apparatus 100 can determine the index information (lastSet) of the coefficient group last scanned by performing an operation of shifting a value obtained by subtracting 1 from a size value of the scan region ((srX+1)*(srY+1)) to the right by 4 (>>4). In other words, an output value of the operation of shifting to the right by 4 can be the same as a value determined by a division by 16 operation. In other words, since the video decoding apparatus 100 determines one coefficient group every 16 transform coefficients, when the total transform coefficients scanned in the scan region are divided by 16, the total coefficient group (or, a value obtained by adding 1 to the index value of the coefficient group last scanned in the forward scan order) can be determined.
[0271] The video decoding apparatus 100 can determine a position lastScanPos of a coefficient last scanned in the forward scan order based on the coordinates srX and srY of the specified scan region, and determine a position Pos of a current transform coefficient as the position lastScanPos of the coefficient last scanned in the forward scan order.
[0272] The video decoding apparatus 100 can initialize i to lastset, decrease i by 1 when i is greater than 0, and can perform the operations included in the repeat statement (for statement) 905. The video decoding apparatus 100 can perform the operations included in the repeat statement (for statement) 905 until i is a value less than 0. At this time, i can be an index indicating a coefficient group. In other words, the video decoding apparatus 100 can perform operations on one coefficient group each time the operations in the repeat statement (for statement) 905 are performed.
[0273] The video decoding apparatus 100 can determine setPos by performing an operation of multiplying i by 16 (i << 4). setPos can indicate index information of a transform coefficient located at a first position of a transform group.
[0274] The video decoding apparatus 100 can determine n as a value of lastScanPos minus setPos (lastScanPos - setPos) when i is a last coefficient group (i == lastSet), otherwise, determine n as 15, and decrease i by 1 when n is equal to or greater than 0, and perform the operations included in the repeat statement (for statement) 910. The video decoding apparatus 100 can perform the operations included in the repeat statement (for statement) 910 (operations related to sig_flag) until i becomes a value less than 0. At this time, n can be index information indicating a position of a transform coefficient within a coefficient group in a forward scan order.
[0275] For example, when the total number of transform coefficients included in a scan region is not an integer multiple of 16, a value of lastScanPos minus setPos from a coefficient group (i = lastset) scanned last in a forward scan order has a value equal to or greater than 0 and less than or equal to 15, and can be determined as n and the repeat statement (for statement) 910 is performed. The video decoding apparatus 100 can determine a position blkpos of a current transform coefficient as a value of index information setPos indicating a position of a first coefficient of a current coefficient group in a ScanOrder arrangement plus n. The ScanOrder arrangement can be an arrangement of positions of transform coefficients in a forward scan order.
[0276] The video decoding apparatus 100 can determine a value sx of a coordinate in a horizontal direction (x-axis direction) currently scanned based on a position (blkpos) of a current transform coefficient and a width width of a scan region. Also, the video decoding apparatus 100 can determine a value sy of a coordinate in a vertical direction (y-axis direction) currently decoded based on the position blkpos of the current transform coefficient and a width log2width of the scan region.
[0277] In a case where sx is 0, sy is srY, and is last y is 0 (sx == 0 && sy == srY && is last y == 0), or in a case where 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 not obtain the significant transform coefficient flag sig flag (sig flag [blkpos]) related to the current transform coefficient from the bitstream, but determine the value of sig flag related to the current coded coefficient as 1. Here, is last x can be a value indicating whether there is a significant transform coefficient having an absolute value greater than 0 among transform coefficients scanned before the current transform coefficient included in the lowermost row of the scan region. Is last y can be a value indicating whether there is a significant transform coefficient having an absolute value greater than 0 among transform coefficients scanned before the current transform coefficient included in the rightmost column of the scan region.
[0278] In a case where sx is not 0, sy is srY, and is last y is 0 (sx!= 0 && sy == srY && is last y == 0), or in a case where sy is not 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 significant transform coefficient flag sig flag (sig flag [blkpos]) related to the current transform coefficient being decoded from the bitstream.
[0279] When the significant transform coefficient flag sig flag of the current transform coefficient is 1, if the coordinate value sx of the current transform coefficient in the x-axis direction is equal to srX (sx == srX), the video decoding device 100 can set is last x to 1, and if the coordinate value sy of the current transform coefficient in the y-axis direction is equal to srY (sy == srY), the video decoding device 100 can set is last y to 1.
[0280] And, when the lastSigScanPos is -1 (i.e., is an initial value), the video decoding apparatus 100 can determine the lastSigScanPos as n. In other words, since the index n indicating the position where the first significant transform coefficient of the coefficient group in the reverse scan order exists is determined as the lastSigScanPos, the lastSigScanPos can be index information indicating the position where the last significant transform coefficient of the coefficient group in the forward scan order exists. The video decoding apparatus 100 can determine the firstSigScanPos as n. When the significant transform coefficient flag sig_flag of the current transform coefficient is 1, the firstSigScanPos is continuously updated as index information (i.e., n) indicating the position of the current transform coefficient, and thus, when the operation is finally performed on the transform coefficients included in the particular coefficient group i, the firstSigScanPos can be index information indicating the position where the first significant transform coefficient within the coefficient group in the forward scan order exists.
[0281] The video decoding apparatus 100 increases the cnt_nz by 1. In other words, the cnt_nz indicating the number of coefficients having a value other than 0 within the current block (or scan region) is updated each time the current transform coefficient is a significant transform coefficient. And, the video decoding apparatus 100 increases the cg_nz[i] indicating the number of coefficients having a value other than 0 within the current coefficient group by 1. In other words, the cg_nz[i] indicating the number of coefficients having a value other than 0 within the current coefficient group is updated each time the current transform coefficient is a significant transform coefficient.
[0282] When i is the last coefficient group (i==lastset), the video decoding apparatus 100 can determine n as a value obtained by subtracting the setPos from the lastScanPos (lastScanPos-setPos), otherwise, determine n as 15, decrease i by 1 when n is greater than or equal to 0, and perform the operations included in the repeat statement (for statement) 915. The video decoding apparatus 100 can perform the operations included in the repeat statement (for statement) 915 (operations related to coeff_abs_level_greater1_flag and coeff_abs_level_greater2_flag) until n becomes a value less than 0.
[0283] The video decoding apparatus 100 can determine the position blkpos of the current transform coefficient as a value obtained by adding 1 to the index information setPos indicating the position of the first coefficient of the current coefficient group in the ScanOrder arrangement.
[0284] The video decoding device 100 can obtain an absolute value abs_coef of the current transform coefficient based on the information gt0 flag, gt1 flag, gt2 flag, and remaining_absolute_value_level related to the current transform coefficient.
[0285] When the significant transform coefficient flag sig_flag[blkpos] of the current transform coefficient is 1, if the sum of cnt_gl (i.e., the number of transform coefficients whose absolute values are greater than 1 among the transform coefficients included in the previously scanned coefficient group) and c1 (i.e., the number of transform coefficients for which coeff_abs_level_greater1_flag is obtained from the bitstream among the previously scanned transform coefficients within the current coefficient group) is less than num_gt1 (i.e., the maximum number of transform coefficients for which coeff_abs_level_greater_flag can be obtained from the bitstream among the transform coefficients whose absolute values are greater than 1), the video decoding device 100 can obtain coeff_abs_level_greater1_flag of the current transform coefficient from the bitstream (coeff_abs_level_greater1_flag[blkpos]). The 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 gtl_flag (gtl_flag[blkpos]) of the current transform coefficient based on the coeff_abs_level_greater1_flag obtained from the bitstream.
[0286] When the value of the flag gtl_flag of the current transform coefficient is 1, the video decoding device 100 can increase c1 by 1. In the case where the flag gtl_flag of the current transform coefficient is 1, the value of c1 is increased by 1 and thus c1 is updated, and thus, when the operation of the repeat statement (for statement) is performed on the transform coefficients thereafter, c1 can indicate the number of transform coefficients for which coeff_abs_level_greater1_flag is obtained from the bitstream among the previously scanned transform coefficients within the current coefficient group.
[0287] When the significant flag sig_flag[blkpos] of the current transform coefficient is 1, if the sum of cnt_g2 (i.e., the number of transform coefficients whose absolute values are greater than 2 among the transform coefficients in the previously scanned coefficient group) and c2 (i.e., the number of transform coefficients whose coeff_abs_level_greater2_flag is obtained from the bitstream in the current coefficient group) is less than num_gt2 (i.e., the maximum number of transform coefficients whose coeff_abs_level_greater_flag can be obtained from the bitstream among the transform coefficients whose absolute values are greater than 2), the video decoding device 100 can obtain the coeff_abs_level_greater2_flag of the current transform coefficient from the bitstream. The 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.
[0288] When the value of the flag gt2_flag of the current transform coefficient is 1, the video decoding device 100 can increase the number c2 of the information gt2_flag of the current transform coefficient by 1. When the flag gt2_flag of the current transform coefficient is 1, the value of c2 is increased by 1 and thus c2 is updated, and thus, when the operation of the repeat statement (for statement) is performed on the transform coefficient thereafter, c2 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.
[0289] Also, the video decoding device 100 can determine escapeDataPresent as 1. The escapeDataPresent can be a flag indicating the presence of information (e.g., the remaining level absolute value information coeff_abs_level_remaining) that needs to be additionally obtained in order to determine the value of the transform coefficient in the current coefficient group.
[0290] When the significant transform coefficient flag sig_flag[blkpos] of the current transform coefficient is 1, and the sum of cnt_g2 (i.e., the number of transform coefficients whose absolute values are greater than 2 among the transform coefficients in the previously scanned coefficient group) and c2 (i.e., the number of transform coefficients in the current coefficient group for which coeff_abs_level_greater2_flag is obtained from the bitstream) is not less than num_gt2 (i.e., the maximum number of transform coefficients for which coeff_abs_level_greater_flag can be obtained from the bitstream among the transform coefficients whose absolute values are greater than 2), the video decoding device 100 can determine escapeDataPresent as 1.
[0291] When cnt_g1 (i.e., the number of transform coefficients whose absolute values are greater than 1 among the transform coefficients included in the previously scanned coefficient group) and c1 (i.e., the number of transform coefficients in the current coefficient group for which coeff_abs_level_greater1_flag is obtained from the bitstream among the previously scanned transform coefficients) are not less than num_gt1 (i.e., the maximum number of transform coefficients for which coeff_abs_level_greater_flag can be obtained from the bitstream among the transform coefficients whose absolute values are greater than 1), the video decoding device 100 can determine escapeDataPresent as 1.
[0292] When escapeDataPresent is 1, when i indicates the last coefficient group (i == lastSet), the video decoding device 100 can determine n as a value obtained by subtracting setPos from lastScanPos (lastScanPos - setPos), otherwise, determine n as 15, and when n is greater than or equal to 0, can decrease i by 1 and perform the operations included in the repeat statement (for statement) 920. The video decoding device 100 can perform the operations included in the repeat statement (for statement) 920 (operations related to coeff_abs_level_remaining) until n becomes a value less than 0.
[0293] The video decoding device 100 can determine the position blkpos of the current transform coefficient as a value obtained by adding 1 to the index information setPos indicating the position of the first coefficient of the current coefficient group in the ScanOrder arrangement.
[0294] When the absolute value of the current coding coefficient is greater than 1 (sig_flag[blkpos]), the video decoding device 100 can determine a base level. When cnt_gt1 (i.e., the number of transform coefficients whose absolute values are greater than 1 among the transform coefficients that are scanned before the current transform coefficient within the current coefficient group) is less than num_gt1 (i.e., the maximum number of transform coefficients for which coeff_abs_level_greater_flag can be obtained from the bitstream among the transform coefficients whose absolute values are greater than 2), when cnt_gt2 (i.e., the number of transform coefficients whose absolute values are greater than 2 among the transform coefficients that are scanned before the current transform coefficient within the current coefficient group) is less than num_gt2 (i.e., the maximum number of transform coefficients for which coeff_abs_level_greater_flag can be obtained from the bitstream among the transform coefficients whose absolute values are greater than 2), the video decoding device 100 can determine the base level as 3. When cnt_gt1 is less than num_gt1, if cnt_gt2 is less than num_gt2, the video decoding device 100 can determine the base level as 2. When cnt_gt1 is not less than num_gt1, the video decoding device 100 can determine the base level as 1.
[0295] The video decoding device 100 can determine the absolute value level abs_coef of the current transform coefficient as a value obtained by adding 1 to the value of gtlflag plus the value of gt2flag 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 remaining absolute value level coeff_abs_level_remaining for the current transform coefficient from the bitstream. The video decoding device 100 can determine the absolute value level abs_coef for the current transform coefficient by adding level_remaining for the current transform coefficient to abs_coef.
[0296] When the absolute value level abs_coef for the current transform coefficient is greater than 2, the video decoding device 100 can increase cnt_gt2 by 1. Also, when the absolute value level abs_coef for the current transform coefficient is greater than 1, the video decoding device 100 can increase cnt_gt1 by 1.
[0297] If escapeDataPresent is 0, when i indicates the last coefficient group (i==lastSet), n can be determined as a value of lastScanPos minus setPos (lastScanPos-setPos), otherwise n is determined as 15, while i is decreased by 1 when n is greater than or equal to 0, and the operation included in the repeat statement (for statement) 925 is performed. The video decoding apparatus 100 can perform the operation included in the repeat statement (for statement) 925 (operation related to abs_coef) until n becomes a value less than 0. It can be determined as a value of n added to index information setPos indicating a position of the first coefficient of the current coefficient group on the ScanOrder arrangement.
[0298] The video decoding apparatus 100 can obtain an absolute value abs_coef of the current transform coefficient based on the information gt0 flag, gt1 flag, gt2 flag, and remaining_absolute_value_level related to the current transform coefficient.
[0299] When the significant transform coefficient flag for the current transform coefficient is 1, if the absolute value (i.e., abs_coef) for the current transform coefficient is greater than or equal to 2, the video decoding apparatus 100 can increase cnt_gt2 by 1. When the significant transform coefficient flag for the current transform coefficient is 1, if the absolute value (i.e., abs_coef) for the current transform coefficient is greater than or equal to 1, cnt_gt1 can be increased by 1.
[0300] When the difference between the position of the last significant transform coefficient lastSigScanPos and the position of the first significant transform coefficient firstSigScanPos in the current coefficient group i scanned in the forward scanning order is greater than 3, the video decoding apparatus 100 can determine the value of signHidden signHidden[i] indicating that at least one sign is hidden in the current coefficient group i as 1. When the difference between the position of the last significant transform coefficient lastSigScanPos and the position of the first significant transform coefficient firstSigScanPos in the current coefficient group scanned in the forward scanning order is not greater than 3, the video decoding apparatus 100 can determine the value of signHidden signHidden[i] indicating that at least one sign is hidden in the current coefficient group i as 0.
[0301] The video decoding device 100 can initialize i as 0, increase i by 1 when i is smaller than or equal to lastSet, and perform operations included in the repeat statement (for statement) 930. The video decoding device 100 can perform operations included in the repeat statement (for statement) 930 until i becomes a value larger than lateSet. At this time, i can be an index indicating a coefficient group. In other words, the video decoding device 100 performs operations for one coefficient group whenever performing operations included in the repeat statement (for statement) 930.
[0302] If the residual sign prediction (rsp) is applied (rsp_apply), the video decoding device 100 can determine n as a value of lastScanPos minus setPos (lastScanPos-setPos) when i is the last coefficient group (i==lastSet), otherwise, determine n as 15, decrease i by 1 when n is greater than or equal to 0, and perform operations included in the repeat statement (for statement) 935. The video decoding device 100 can perform operations included in the repeat statement 935 until n becomes a value smaller than 0.
[0303] The video decoding device 100 can determine a position blkpos of a transform coefficient currently being decoded as index information setPos indicating a position of a first coefficient of a current coefficient group in an arrangement in a forward scanning order ScanOrder plus a value of a current n.
[0304] If the position blkpos of the transform coefficient currently being decoded is not rsp_pos but a position hidden_pos of a transform coefficient whose sign is hidden, the video decoding device 100 can determine information sign[blkpos] about a sign of the transform coefficient currently being decoded as information hidden_sign about a sign of the hidden transform coefficient.
[0305] If the position blkpos of the transform coefficient currently being decoded is not a position hidden_pos of a transform coefficient whose sign is hidden, the video decoding device 100 can obtain information (sign[blkpos]) about a sign of the transform coefficient currently being decoded from a bitstream.
[0306] If the position blkpos of the transform coefficient currently being decoded is rsp_pos, the video decoding device 100 can obtain information sign_rsp[blkpos] about an rsp sign of the transform coefficient currently being decoded from a bitstream.
[0307] If rsp is not applied, when i is 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 is decremented by 1, and the operation included in the repeating statement (for statement) 940 is executed. The video decoding device 100 can execute the operation included in the repeating statement (for statement) 940 until n becomes a value less than 0.
[0308] 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 in the current coefficient group in the ScanOrder arrangement according to the forward scan order, to the current value of n.
[0309] Information related to the symbol of the current transform coefficient, sign[blkpos], can be obtained from the bitstream when the value of the valid transform coefficient flag of the current transform coefficient is 1, the value of the flag indicating whether the symbol data hiding is enabled is 0, or there are no symbols hidden in 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 position of the first valid transform coefficient, firstSigScanPos.
[0310] Figures 9d to 9f This is a diagram illustrating the residual coding syntax structure according to another embodiment.
[0311] refer to Figures 9d to 9f The video decoding device 100 can scan the syntax element information related to the transform coefficients, and decode the transform coefficients based on the scanned syntax element information to recover the transform coefficients.
[0312] First, the video decoding apparatus 100 can obtain, from the bitstream, syntax element information last_sig_coeff_x and last_sig_coeff_y indicating coordinates of the specified scan region. At this time, the syntax element information last_sig_coeff_x can indicate a coordinate value of a horizontal direction (x-axis direction) of an effective transform coefficient located last in a forward scan order with a coordinate of an upper left corner of the current block as a reference, and the syntax element information last_sig_coeff_y can indicate a coordinate value of a vertical direction (y-axis direction) of the effective transform coefficient located last in the current block in the forward scan order with the coordinate of the upper left corner of the current block as a reference. The video decoding apparatus 100 can determine coordinates LastSigcoeffX and LastSigCoeffY of the specified scan region based on the syntax element information last_sig_coeff_x and last_sig_coeff_y.
[0313] The video decoding apparatus 100 can initialize a position lastScanPos of an effective transform coefficient located last in the sub-block in the forward scan order to 16. The video decoding apparatus 100 can initialize lastSubBlock of the sub-block in which the effective transform coefficient located last in the forward scan order is located. At this time, the initialized value can indicate a sub-block located last among the sub-blocks of the current block scanned in the forward scan order. In other words, the lastSubBlock can be initialized to a value indicating a sub-block located last among the sub-blocks scanned in the forward scan order based on the height and the width of the current block.
[0314] The video decoding apparatus 100 can perform operations within the do-while loop statement 950 when the horizontal direction position xC of the current coefficient is not LastSigcoeffX or the vertical direction position yC of the current coefficient is not LastSigcoeffY, and can not perform the operations within the do-while loop statement 950 when xC is LastSigcoeffX and the vertical direction position yC of the current coefficient is LastSigcoeffY.
[0315] If lastScanPos is 0, the video decoding device 100 can determine lastScanPos as 16, and decrease lastSubblock by 1. In other words, at the end of scanning within one subblock in the reverse scanning order (i.e., when lastScanPos is 0), lastScanPos is initialized as 16 to scan the next subblock in the reverse scanning order, and lastSubBlock is decreased by 1 to scan the next subblock. The video decoding device 100 can scan the transform coefficients within the current subblock lastSubblock in the reverse scanning order while decreasing lastScanPos by 1.
[0316] The video decoding device 100 can determine a position xS in a horizontal direction and a position yS in a vertical direction of the current subblock. The video decoding device 100 can determine the position of the current subblock based on the ScanOrder arrangement determined in the predetermined forward scanning order for the current block. In other words, the video decoding device 100 can determine the position of the current subblock based on the height log2height and the width log2width of the current block, the scan index scanIdx indicating the predetermined scanning order, and the value lastSubBlock indicating the current subblock. At this time, xS and yS can be the positions of the subblock when the subblock is regarded as one pixel, not the actual positions of the subblock. In other words, regardless of the width and the height of the subblock, the difference in the horizontal direction and the vertical direction of the subblock between subblocks adjacent to each other can be 1.
[0317] Also, the video decoding device 100 can determine a horizontal direction position xC and a vertical direction position yC of the current transform coefficient based on the ScanOrder arrangement determined in the predetermined forward scanning order for the current subblock. In other words, the video decoding device 100 can determine the position (xC, yC) of the current transform coefficient based on the height (log24=2) and the width (log24=2) of the current subblock, the scan index scanIdx indicating the predetermined scanning order, the position (xS, yS) of the current subblock, and the value lastScanPos indicating the position of the current transform coefficient within the current subblock.
[0318] When the position yC in the vertical direction of the current transform coefficient is LastSigcoeffY, the video decoding device 100 does not perform the operation within the do-while loop statement 950 any more, and thus lastScanPos determined through the do-while loop statement 950 can be index information indicating a position of the last significant transform coefficient within the sub-block including the last significant transform coefficient within the current block scanned in the forward scanning order, and lastSubBlock can be index information indicating the sub-block in which the last significant transform coefficient is located within the current block.
[0319] The video decoding device 100 can initialize i as lastSubBlock, decrease i by 1 when i is greater than 0, and perform the operation included in the repeat statement (for statement) 960. The video decoding device 100 can perform the operation included in the repeat statement (for statement) 960 until i becomes a value less than 0. At this time, i can be index information indicating a coefficient group. In other words, the video decoding device 100 can perform the operation on one sub-block whenever performing the operation in the repeat statement (for statement) 960.
[0320] The video decoding device 100 can determine a position xS in the horizontal direction and a position yS in the vertical direction of the current sub-block.
[0321] When i indicating the current sub-block has a value less than a value (lastSubBlock) indicating the sub-block in which the last significant transform coefficient is located or a value greater than a value (0) indicating the sub-block including the DC coefficient, the video decoding device 100 can obtain coded_sub_block_flag[xS][yS] for the current sub-block i. The coded_sub_block_flag[xS][yS] can be flag information indicating whether at least one significant transform coefficient is included in the current sub-block i.
[0322] When the current sub-block is the sub-block lastSubBlock including the last significant transform coefficient, the video decoding device 100 can initialize n to lastScanPos-1, otherwise initialize n to 15, decrease n by 1 when n is greater than or equal to 0, and perform the operations included in the repeat statement (for statement). The video decoding device 100 can perform the operations in the repeat statement (for statement) 960 until n becomes a value less than 0. At this time, n can be an index indicating the position of the current transform coefficient within the sub-block. In other words, the video decoding device 100 can perform the operations on one coefficient group whenever the operations included in the repeat statement (for statement) are performed. In other words, the video decoding device 100 can perform the operations (operations related to sig_coeff_flag) on one sub-block whenever the operations included in the repeat statement (for statement) 960 are performed.
[0323] The video decoding device 100 can determine the position xCand yCof the current transform coefficient n.
[0324] When coded_sub_block_flag[xS][yS] for the current sub-block is 1, n is greater than 0, or inferSbDcSigCoeffFlag is 0, the video decoding device 100 can obtain a flag sig_coeff_flag[xC][yC] for the current transform coefficient from the bitstream. The sig_coeff_flag[xC][yC] can be a flag indicating whether the current transform coefficient is a significant transform coefficient.
[0325] If the value of sig_coeff_flag[xC][yC] is 1, inferSbDcSigCoeffFlag can be determined to be 0.
[0326] The video decoding device 100 can initialize the value of the position firstScanPos of the transform coefficient first scanned in the current sub-block in the forward scanning order, and initialize the value of the position lastSigScanPos of the transform coefficient last scanned in the current sub-block in the forward scanning order. The video decoding device 100 can initialize the value of numGreater1Flag indicating the number of Greater1Flag, and initialize the value of lastGreater1ScanPos indicating the final position of Greater1Flag obtained in the forward scanning order.
[0327] The video decoding device 100 can initialize cg_nz[i] indicating the number of transform coefficients that are not 0 within the sub-block i.
[0328] The video decoding device 100 can initialize n to 15, and when n is greater than or equal to 0, can perform operations within a repeat statement (for statement) 965 while decreasing n by 1 until n is less than 0.
[0329] The video decoding device 100 can determine a position xCand yCof a current transform coefficient n.
[0330] When the significant transform coefficient flag sig_coeff_flag for the current transform coefficient is 1, and if numGreater1Flag is less than 8, the video decoding device 100 can obtain coeff_level_greater1_flag[n] for the current transform coefficient n and increase the value of numGreater1Flag by 1. coeff_level_greater1_flag[n] can be flag information indicating whether the absolute value of the level of the transform coefficient n is greater than 1. The video decoding device 100 can determine Greater1Flag[n] based on coeff_level_greater1_flag[n].
[0331] If the value of coeff_abs_level_greater_flag for the current transform coefficient is 1 and the value of lastGreater1ScanPos is the initial value, the video decoding device 100 can determine lastGreater1ScanPos as the position n of the current transform coefficient within the current sub-block. Thus, lastGreater1ScanPos can be index information indicating the position of the coefficient having the value of coeff_abs_level_greater_flag located last in the forward scanning order within the current sub-block. Otherwise (when the value of coeff_abs_level_greater1_flag for the current transform coefficient is 1 and the value of lastGreater1ScanPos is not the initial value), escapeDataPresent can be determined as 1 when coeff_abs_level_greater1_flag is 1.
[0332] If numGreater1Flag is not less than 8, the video decoding device 100 can determine escapeDataPresent as 1.
[0333] When lastSigScanPos indicating the position of the last significant transform coefficient in the forward scanning order within the current sub-block has the initial value, the video decoding device 100 can determine lastSigScanPos as the position n of the transform coefficient within the current sub-block.
[0334] The video decoding device 100 can determine the firstSigScanPos indicating the position of the significant transform coefficient located at the first in the forward scan order within the current sub-block as the position n of the transform coefficient within the current sub-block. When the significant transform coefficient flag sig_coeff_flag[xC][yC] of the current transform coefficient is 1, the value of the firstSigScanPos is continuously updated as the index information n indicating the position of the current transform coefficient within the current sub-block, and thus the firstSigScanPos can be the index information indicating the position of the first significant transform coefficient existing in the sub-block in the forward scan order when the operation is finally performed on the transform coefficient in the current sub-block.
[0335] When the difference between the lastSigScanPos and the firstSigScanPos is greater than 3, the video decoding device 100 can determine the sigHidden value as 1, and when the difference between the lastSigScanPos and the firstSigScanPos is not greater than 3, the video decoding device 100 can determine the sigHidden value as 0. At this time, the sigHidden can be a value indicating that the sign of at least one transform coefficient is hidden for the current sub-block.
[0336] When the position lastGreater1ScanPos of the transform coefficient in which the coeff_abs_level_greater1_flag (Greater1Flag) of the transform coefficient scanned in the forward scan order and obtained from the bitstream is lastly obtained is not an initial value (i.e., when at least one Greater1Flag is obtained from the bitstream in the current sub-block), the video decoding device 100 can obtain the flag coeff_abs_level_greater2_flag[lastGreater1ScanPos] of the transform coefficient at the lastGreater1ScanPos position from the bitstream. The coeff_abs_level_greater2_flag can be a flag indicating whether the absolute value of the transform coefficient is greater than 2. When the value of the flag coeff_abs_level_greater2_flag[lastGreater1ScanPos] of the transform coefficient at the lastGreater1ScanPos position is 1, the video decoding device 100 can determine the escapeDataPresent as 1. The video decoding device 100 can determine the Greater2Flag[n] based on the coeff_level_greater2_flag[n].
[0337] The video decoding device 100 can initialize numSigCoeff. At this time, numSigCoeff can mean the number of significant transform coefficients among transform coefficients scanned before the current transform coefficient in the inverse scan order.
[0338] The video decoding device 100 can initialize n to 15, decrease n by 1 when n is greater than or equal to 0 and perform operations within the for statement 970, and can not perform operations within the for statement 970 when n is less than 0. The video decoding device 100 can perform operations such as scanning information about transform coefficients within the current sub-block in the inverse scan order.
[0339] The video decoding device 100 can determine the position xCand yCof the current transform coefficient based on the position n of the current transform coefficient within the current sub-block.
[0340] When the value of the significant transform coefficient flag sig_coeff_flag[xC][yC] related to the current transform coefficient is 1, the video decoding device 100 can determine the value obtained by adding 1 to the sum of the value of the flag coeff_abs_level_greater1_flag related to the current transform coefficient and the value of the flag coeff_abs_level_greater2_flag of the current transform coefficient as a base level (baseLevel).
[0341] If numSigCoeff is less than 8 and the position n of the current transform coefficient is lastGreater1ScanPos, the video decoding device 100 can obtain the remaining level value information coeff_abs_level_remaining[n] for the current transform coefficient n from the bitstream when the base level is 3.
[0342] If numSigCoeff is less than 8 and the position n of the current transform coefficient is not lastGreater1ScanPos, the video decoding device 100 can obtain the remaining level value information coeff_abs_level_remaining[n] for the current transform coefficient n from the bitstream when the base level is 2. If numSigCoeff is greater than 8, the video decoding device 100 can obtain the remaining level value information coeff_abs_level_remaining[n] for the current transform coefficient n from the bitstream when the base level is 1.
[0343] The video decoding apparatus 100 can add the base level of the current transform coefficient and the residual level value of the current transform coefficient to determine a horizontal value of the current transform coefficient within the current block, i.e., TransCoeffLevel[x0][y0][cIdx][xC][yC]. Here, cIdx can be an index indicating a color component.
[0344] The operations included in the repeat statement (for statement) 975 can be performed until i gradually increases from 0 by 1 to a value less than or equal to lastSubBlock. At this time, i can be an index indicating a subblock. In other words, the video decoding apparatus 100 can perform operations on one coefficient group each time the statements within the for statement 975 are executed.
[0345] When the flag coded_sub_block_flag[xS][yS] for the current subblock i is 1, in the case where rsp is applied (rsp_apply), the video decoding apparatus 100 can determine n as 15, perform the operations within the for statement 980 when n is greater than or equal to 0, and after n is reduced by 1, the operations within the for statement 980 can be performed again when n is greater than or equal to 0. If n is less than 0, the operations within the for statement 980 can not be performed again.
[0346] The video decoding apparatus 100 can determine a horizontal position and a vertical position xC and yC of the current transform coefficient corresponding to the position n of the current transform coefficient within the current subblock. The video decoding apparatus 100 can determine the position blkpos of the current transform coefficient based on xC and yC.
[0347] When the position blkpos of the current transform coefficient is not rsp_pos but hidden_pos which is the position of the transform coefficient hidden by the sign, the video decoding apparatus 100 can determine the sign of the current transform coefficient as the sign hidden_sign of the hidden transform coefficient.
[0348] Otherwise (if not hidden_pos which is the position of the transform coefficient hidden by the sign), the video decoding apparatus 100 can obtain information sign[xC][yC] related to the sign of the current transform coefficient from the bitstream.
[0349] When the position of the current transform coefficient is rsp_pos, the video decoding apparatus 100 can obtain information sign_rsp[xC][yC] related to the rsp sign of the current transform coefficient from the bitstream.
[0350] If the rsp is not applied, the video decoding device 100 can determine n as 15, perform the operation within the for statement 985 when n is greater than 0, perform the operation within the for statement 985 again when n is still greater than or equal to 0 after n is decreased by 1, and not perform the operation within the for statement 985 when n is less than 0.
[0351] The video decoding device 100 can determine a position of the current transform coefficient in the horizontal direction and a position of the current transform coefficient in the horizontal direction, i.e., xCand yC, corresponding to a position n of the current transform coefficient within the current sub-block. The video decoding device 100 can determine a position blkposof the current transform coefficient based on xCand yC.
[0352] If a value of a significant transform coefficient flag sig_coeffi_flag[xC][yC] of the current transform coefficient is 1, a value of a flag sign_data_hiding_enabled_flag indicating whether to enable hiding of sign data is 0, or there is no hidden sign (! signHidden[i]) for the current sub-block, or a position of the current transform coefficient (i.e., a position of the first significant transform coefficient firstSigScanPos) in the current sub-block is not 0 in a forward scanning order, the video decoding device 100 can obtain a sign information sign[xC][yC] of the current transform coefficient from the bitstream.
[0353] In the following, a method of determining data units usable when a video decoding device 100 decodes an image according to an embodiment will be described with reference to Figures 10 to 23 A method of determining data units usable when a video decoding device 100 decodes an image according to an embodiment will be described with reference to
[0354] Figure 10 A process of determining at least one coding unit as the video decoding device 100 divides a current coding unit according to an embodiment is illustrated.
[0355] According to an embodiment, the video decoding device 100 can determine a shape of a coding unit by using block shape information and determine a shape into which the coding unit is divided by using division shape information. In other words, a division method of the coding unit indicated by the division shape information can be determined based on what kind of block shape is indicated by the block shape information used by the video decoding device 100.
[0356] According to an embodiment, the video decoding apparatus 100 can use block shape information indicating that the current coding unit has a non-square shape. For example, the video decoding apparatus 100 can determine whether to split the non-square current coding unit or to split the non-square current coding unit via a specific method according to the split shape information. Referring to Figure 10 When the block shape information of the current coding unit 1000 indicates a non-square shape, the video decoding apparatus 100 can determine whether to split the non-square current coding unit or to split the non-square current coding unit via a specific method according to the split shape information. For example, the video decoding apparatus 100 can determine whether to split the non-square current coding unit 1000 or to split the non-square current coding unit 1000 via a specific method according to the split shape information. Referring to
[0357] Referring to Figure 10 According to an embodiment, the video decoding apparatus 100 can determine two coding units 1010b by splitting the current coding unit 1000 in a vertical direction based on the split shape information indicating splitting in the vertical direction. The video decoding apparatus 100 can determine two coding units 1010c by splitting the current coding unit 1000 in a horizontal direction based on the split shape information indicating splitting in the horizontal direction. The video decoding apparatus 100 can determine four coding units 1010d by splitting the current coding unit 1000 in vertical and horizontal directions based on the split shape information indicating splitting in the vertical and horizontal directions. However, the split shape into which the non-square coding unit can be split is not limited to the above shapes, and can include any shape that can be indicated by the split shape information. The predetermined split shape into which the non-square coding unit is split will now be described in detail through various embodiments.
[0358] Figure 11 FIG. 10 illustrates a process in which the video decoding apparatus 100 splits a coding unit having a non-square shape to determine at least one coding unit according to an embodiment.
[0359] According to an embodiment, the video decoding apparatus 100 can use block shape information indicating that the current coding unit has a non-square shape. The video decoding apparatus 100 can determine whether to split the non-square current coding unit or to split the non-square current coding unit via a specific method according to the split shape information. Referring to Figure 11When the block shape information of the current coding unit 1100 or 1150 indicates a non-square shape, the video decoding apparatus 100 can not partition the coding unit 1110 or 1160 having the same size as the current coding unit 1100 or 1150 according to the partition shape information indicating no partition, or can determine to partition the determined coding units 1120a, 1120b, 1130a, 1130b, 1130c, 1170a, 1170b, 1180a, 1180b, and 1180c based on the partition shape information indicating a specific partition method. The specific partition method of partitioning a non-square coding unit will now be described in detail through various embodiments.
[0360] According to an embodiment, the video decoding apparatus 100 can determine the shape into which a coding unit is partitioned by using the partition shape information, and in this case, the partition shape information can indicate the number of at least one coding unit generated as the coding unit is partitioned. Referring to Figure 11 When the partition shape information indicates that the current coding unit 1100 or 1150 is partitioned into two coding units, the video decoding apparatus 100 can determine two coding units 1120a and 1120b or 1170a and 1170b included in the current coding unit 1100 or 1150 by partitioning the current coding unit 1100 or 1150 based on the partition shape information.
[0361] According to an embodiment, when the video decoding apparatus 100 partitions the current coding unit 1100 or 1150 having a non-square shape based on the partition shape information, the video decoding apparatus 100 can partition the current coding unit 1100 or 1150 considering the position of the long side of the current coding unit 1100 or 1150 having a non-square shape. For example, the video decoding apparatus 100 can determine a plurality of coding units by partitioning the current coding unit 1100 or 1150 in the direction of the long side of the current coding unit 1100 or 1150 considering the shape of the current coding unit 1100 or 1150.
[0362] According to an embodiment, when the split shape information indicates that the coding unit is split into an odd number of blocks, the video decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 1100 or 1150. For example, when the split shape information indicates that the current coding unit 1100 or 1150 is split into three coding units, the video decoding apparatus 1100 can split the current coding unit 1100 or 1150 into three coding units 1130a, 1130b, 1130c, 1180a, 1180b, and 1180c. According to an embodiment, the video decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 1100 or 1150, and the sizes of the determined coding units can not all be the same. For example, the size of a coding unit 1130b or 1180b among the determined odd number of coding units 1130a, 1130b, 1130c, 1180a, 1180b, and 1180c can be different from the sizes of the coding units 1130a, 1130c, 1180a, and 1180c. In other words, the coding units that can be determined by splitting the current coding unit 1100 or 1150 can have various types of sizes, and the odd number of coding units 1130a, 1130b, 1130c, 1180a, 1180b, and 1180c can have different sizes according to circumstances.
[0363] According to an embodiment, when the split shape information indicates that the coding unit is split into an odd number of blocks, the video decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 1100 or 1150, and in addition, can set a specific restriction on at least one coding unit among the odd number of coding units generated via the splitting. Referring to Figure 11 For the coding units 1130b and 1180b located at the center among the three coding units 1130a, 1130b, 1130c, 1180a, 1130b, and 1180c generated by splitting the current coding unit 1100 or 1150, the decoding process performed by the video decoding apparatus 100 can not be the same as the decoding process performed on the other coding units 1130a, 1130c, 1180a, and 1180c. For example, unlike the other coding units 1130a, 1130c, 1180b, and 1180c, the video decoding apparatus 100 can restrict the coding units 1130b and 1180b located at the center not to be split any more or to be split only a specific number of times.
[0364] Figure 12 FIG. 1 illustrates a process in which a video decoding apparatus 100 splits a coding unit based on at least one of block shape information and split shape information according to an embodiment.
[0365] According to an embodiment, the video decoding apparatus 100 can determine that the first coding unit 1200 having a square shape is divided or not divided into coding units based on at least one of the block shape information and the division shape information. According to an embodiment, when the division shape information indicates that the first coding unit 1200 is divided in a horizontal direction, the video decoding apparatus 100 can determine a second coding unit 1210 by dividing the first coding unit 1200 in the horizontal direction. The first coding unit, the second coding unit, and the third coding unit used according to an embodiment are terms used to indicate a relationship before and after dividing a coding unit. For example, the second coding unit can be determined by dividing the first coding unit, and the third coding unit can be determined by dividing the second coding unit. Hereinafter, it is understood that the relationship between the first to third coding units is consistent with the above-described features.
[0366] According to an embodiment, the video decoding apparatus 100 can determine whether the determined second coding unit 1210 is divided or not divided into coding units based on at least one of the block shape information and the division shape information. Referring to Figure 12 , the video decoding apparatus 100 can divide or not divide the second coding unit 1210 having a non-square shape and determined by dividing the first coding unit 1200 into at least one third coding unit 1220a, 1220b, 1220c, 1220d, etc., based on at least one of the block shape information and the division shape information. The video decoding apparatus 100 can obtain at least one of the block shape information and the division shape information, and obtain a plurality of second coding units (for example, the second coding unit 1210) having various shapes by dividing the first coding unit 1200 based on at least one of the obtained block shape information and division shape information, and the second coding unit 1210 can be divided according to a method of dividing the first coding unit 1200 based on at least one of the block shape information and the division shape information. According to an embodiment, when the first coding unit 1200 is divided into the second coding unit 1210 based on at least one of the block shape information and the division shape information about the first coding unit 1200, the second coding unit 1210 can also be divided into a third coding unit (for example, 1220a, 1220b, 1220c, 1220d, etc.) based on at least one of the block shape information and the division shape information about the second coding unit 1210. In other words, a coding unit can be recursively divided based on at least one of the division shape information and the block shape information about each coding unit. Accordingly, a square coding unit can be determined from a non-square coding unit, and such a square coding unit can be recursively divided to determine a non-square coding unit. Referring to Figure 12A predetermined coding unit (e.g., a coding unit located at the center or a square coding unit) among the odd number of third coding units 1220b, 1220c, and 1220d determined by dividing the second coding unit 1210 having a non-square shape can be recursively divided. According to an embodiment, the third coding unit 1220c having a square shape among the third coding units 1220b, 1220c, and 1220d can be divided into a plurality of fourth coding units in a horizontal direction. A fourth coding unit 1240 having a non-square shape among the plurality of fourth coding units can be again divided into a plurality of coding units. For example, the fourth coding unit 1240 having a non-square shape can be divided into odd number of coding units 1250a, 1250b, and 1250c.
[0367] Methods that can be used to recursively divide coding units will be described below through various embodiments.
[0368] According to an embodiment, the video decoding apparatus 100 can divide or determine not to divide the second coding unit 1210 into coding units based on at least one of the block shape information and the division shape information. According to an embodiment, the video decoding apparatus 100 can divide the second coding unit 1210 having a non-square shape into odd number of third coding units 1220b, 1220c, and 1220d. The video decoding apparatus 100 can set a specific restriction on a predetermined third coding unit among the third coding units 1120b, 1120c, and 1120d. For example, the video decoding apparatus 100 can restrict the third coding unit 1220c located at the center of the third coding units 1220b, 1220c, and 1220d from being divided again, or restrict the third coding unit 1220c from being divided a settable number of times. Referring to Figure 12 , the video decoding apparatus 100 can restrict the third coding unit 1220c located at the center of the third coding units 1220b, 1220c, and 1220d included in the second coding unit 1210 having a non-square shape from being divided again, divided into a predetermined division shape (e.g., divided into four coding units or divided into a shape corresponding to a shape into which the second coding unit 1210 is divided), or divided only a predetermined number of times (e.g., divided only n times, where n > 0). However, such a restriction on the third coding unit 1220c located at the center is merely an example and should not be construed as being limited to these embodiments, but should be construed as including various restrictions in which the third coding unit 1220c located at the center can be decoded differently from the other third coding units 1220b and 1220d.
[0369] According to an embodiment, the video decoding apparatus 100 can obtain at least one of the block shape information and the partition shape information for partitioning the current coding unit from a predetermined position in the current coding unit.
[0370] Figure 13 FIG. 13 illustrates a method of determining a predetermined coding unit in an odd number of coding units according to an embodiment of the video decoding apparatus 100. Figure 13 At least one of the block shape information and the partition shape information of the current coding unit 1300 can be obtained from a sample at a predetermined position among a plurality of samples included in the current coding unit 1300 (e.g., a sample 1340 located at the center). However, the predetermined position in the current coding unit 1300 from which at least one of the block shape information and the partition shape information is obtained is not limited to the center position as illustrated in FIG. 13, but can be any position included in the current coding unit 1300 (e.g., an uppermost position, a lowermost position, a left position, a right position, a left uppermost position, a left lowermost position, a right uppermost position, or a right lowermost position, etc.). The video decoding apparatus 100 can determine whether to partition the current coding unit into coding units having various shapes and sizes or not by obtaining at least one of the block shape information and the partition shape information from the predetermined position. Figure 13
[0371] According to an embodiment, the video decoding apparatus 100 can select one of the coding units when the current coding unit is partitioned into a predetermined number of coding units. The method of selecting one of the plurality of coding units can vary, and such a method will be described below through various embodiments.
[0372] According to an embodiment, the video decoding apparatus 100 can partition the current coding unit into a plurality of coding units, and determine a coding unit at a predetermined position.
[0373] Figure 13 FIG. 13 illustrates a method of determining a predetermined coding unit in an odd number of coding units according to an embodiment of the video decoding apparatus 100.
[0374] According to an embodiment, the video decoding apparatus 100 can determine a coding unit located at the center from among the odd number of coding units using information indicating a position of each of the odd number of coding units. Referring to FIG. 14, the video decoding apparatus 100 can determine a coding unit located at the center from among the odd number of coding units using information indicating a position of each of the odd number of coding units. Figure 13 The video decoding apparatus 100 can determine the odd-numbered coding units 1320a, 1320b and 1320c by partitioning the current coding unit 1300. The video decoding apparatus 100 can determine the center coding unit 1320b by using information about positions of the odd-numbered coding units 1320a, 1320b and 1320c. For example, the video decoding apparatus 100 can determine the coding unit 1320b located at the center by determining positions of the coding units 1320a, 1320b and 1320c based on information indicating positions of predetermined samples included in the coding units 1320a, 1320b and 1320c. In detail, the video decoding apparatus 100 can determine the coding unit 1320b located at the center by determining positions of the coding units 1320a, 1320b and 1320c based on information indicating positions of samples 1330a, 1330b and 1330c on the left upper end of the coding units 1320a, 1320b and 1320c.
[0375] According to an embodiment, the information indicating the positions of the samples 1330a, 1330b and 1330c on the left upper end included in the coding units 1320a, 1320b and 1320c, respectively, can include information about positions or coordinates of the coding units 1320a, 1320b and 1320c in a picture. According to an embodiment, the information indicating the positions of the samples 1330a, 1330b and 1330c on the left upper end included in the coding units 1320a, 1320b and 1320c, respectively, can include information indicating widths or heights of the coding units 1320a, 1320b and 1320c included in the current coding unit 1300, and the widths or heights can correspond to information indicating differences between coordinates of the coding units 1320a, 1320b and 1320c in the picture. In other words, the video decoding apparatus 100 can determine the coding unit 1320b located at the center by directly using information about positions or coordinates of the coding units 1320a, 1320b and 1320c in the picture or by using information about widths or heights of the coding units corresponding to the differences between the coordinates.
[0376] According to an embodiment, the information indicating the position of the sample 1330a of the left upper side of the upper end coding unit 1320a can indicate (xa, ya) coordinates, the information indicating the position of the sample 1330b of the left upper side of the center coding unit 1320b can indicate (xb, yb) coordinates, and the information indicating the position of the sample 1330c of the left upper side of the lower end coding unit 1320c can indicate (xc, yc) coordinates. The video decoding apparatus 100 can determine the center coding unit 1320b by using the coordinates of the samples 1330a, 1330b, and 1330c of the left upper side included in the coding units 1320a, 1320b, and 1320c, respectively. For example, when the coordinates of the samples 1330a, 1330b, and 1330c of the left upper side are arranged in ascending order or descending order, the coding unit 1320b including the coordinates (xb, yb) of the sample 1330b located at the center can be determined as the coding unit located at the center among the coding units 1320a, 1320b, and 1320c determined by the division of the current coding unit 1300. However, the coordinates indicating the positions of the samples 1330a, 1330b, and 1330c of the left upper side can represent coordinates indicating absolute positions in a picture, and in addition, (dxb, dyb) coordinates (i.e., information indicating the relative position of the sample 1330b of the left upper side of the center coding unit 1320b) and (dxc, dyc) coordinates (i.e., information indicating the relative position of the sample 1330c of the left upper side of the lower end coding unit 1320c) can be used based on the position of the sample 1330a of the left upper side of the upper end coding unit 1320a. In addition, the method of determining a coding unit at a predetermined position by using the coordinates of the samples as information indicating the positions of the samples included in the coding unit should not be interpreted as being limited to the above-described method, and can be interpreted as being capable of various arithmetic methods using the coordinates of the samples.
[0377] According to an embodiment, the video decoding apparatus 100 can divide the current coding unit 1300 into a plurality of coding units 1320a, 1320b, and 1320c, and select a coding unit from among the coding units 1320a, 1320b, and 1320c according to a predetermined criterion. For example, the video decoding apparatus 100 can select the coding unit 1320b having a different size from among the coding units 1320a, 1320b, and 1320c.
[0378] According to an embodiment, the video decoding apparatus 100 can determine the width or height of the coding units 1320a, 1320b, and 1320c by using the (xa, ya) coordinates (i.e., information indicating the position of the sample 1330a of the left upper end of the upper end coding unit 1320a), the (xb, yb) coordinates (i.e., information indicating the position of the sample 1330b of the left upper end of the center coding unit 1320b), and the (xc, yc) coordinates (i.e., information indicating the position of the sample 1330c of the left upper end of the lower end coding unit 1320c), respectively. The video decoding apparatus 100 can determine the size of the coding units 1320a, 1320b, and 1320c by using the coordinates (xa, ya), (xb, yb), and (xc, yc) of the information indicating the positions of the coding units 1320a, 1320b, and 1320c, respectively.
[0379] According to an embodiment, the video decoding apparatus 100 can determine the width of the upper end coding unit 1320a as xb-xa and the height as yb-ya. According to an embodiment, the video decoding apparatus 100 can determine the width of the center coding unit 1320b as xc-xb and the height as yc-yb. According to an embodiment, the video decoding apparatus 100 can determine the width or height of the lower end coding unit by using the width and height of the current coding unit and the width and height of the upper end coding unit 1320a and the center coding unit 1320b. The video decoding apparatus 100 can determine a coding unit having a different size from other coding units based on the determined width and height of the coding units 1320a, 1320b, and 1320c. Referring to Figure 13 , the video decoding apparatus 100 can determine the center coding unit 1320b having a different size from the sizes of the upper end coding unit 1320a and the lower end coding unit 1320c as a coding unit at a predetermined position. However, the process in which the video encoding apparatus 100 determines a coding unit having a different size from other coding units is merely an embodiment of determining a coding unit at a predetermined position by using the size of the coding unit determined based on the sample coordinates, and thus various processes of determining a coding unit at a predetermined position by comparing the sizes of the coding units determined according to the predetermined sample coordinates can be used.
[0380] However, the position of the sample considered to determine the position of the coding unit is not limited to the left upper end as described above, and information on the position of any sample included in the coding unit can be used.
[0381] According to an embodiment, the video decoding apparatus 100 can consider a shape of a current coding unit to select a coding unit at a predetermined position among an odd number of coding units determined by partitioning the current coding unit. For example, when the current coding unit has a non-square shape with a width longer than a height, the video decoding apparatus 100 can determine a coding unit at a predetermined position in a horizontal direction. In other words, the video decoding apparatus 100 can determine one of coding units having different positions in the horizontal direction and impose a restriction on the one coding unit. When the current coding unit has a non-square shape with a height longer than a width, the video decoding apparatus 100 can determine a coding unit at a predetermined position in a vertical direction. In other words, the video decoding apparatus 100 can determine one of coding units having different positions in the vertical direction and impose a restriction on the one coding unit.
[0382] According to an embodiment, the video decoding apparatus 100 can use information indicating a position of each of an even number of coding units to determine a coding unit at a predetermined position from among the even number of coding units. The video decoding apparatus 100 can determine the even number of coding units by partitioning a current coding unit and determine a coding unit at a predetermined position by using information about positions of the even number of coding units. Detailed processes thereof can correspond to those of determining a coding unit at a predetermined position (e.g., a center position) from among an odd number of coding units described in Figure 13
[0383] According to an embodiment, when a current coding unit having a non-square shape is partitioned into a plurality of coding units, a predetermined coding unit at a predetermined position can be determined from among the plurality of coding units using predetermined information about the coding unit at the predetermined position during a partitioning process. For example, the video decoding apparatus 100 can use at least one of block shape information and partition shape information stored in a sample included in a center coding unit to determine a coding unit located at a center from among a plurality of coding units obtained by partitioning a current coding unit during a partitioning process.
[0384] Reference Figure 13 , the video decoding apparatus 100 can divide the current coding unit 1300 into a plurality of coding units 1320a, 1320b, and 1320c based on at least one of the block shape information and the partition shape information, and determine the coding unit 1320b located at the center from the plurality of coding units 1320a, 1320b, and 1320c. In addition, the video decoding apparatus 100 can determine the coding unit 1320b located at the center in consideration of a position at which at least one of the block shape information and the partition shape information is obtained. In other words, at least one of the block shape information and the partition shape information of the current coding unit 1300 can be obtained from a sample 1340 located at the center of the current coding unit 1300, and when the current coding unit 1300 is divided into a plurality of coding units 1320a, 1320b, and 1320c based on at least one of the block shape information and the partition shape information, the coding unit 1320b including the sample 1340 can be determined as the coding unit located at the center. However, the information for determining the coding unit located at the center should not be construed as being limited to at least one of the block shape information and the partition shape information, but various types of information can be used in determining the coding unit located at the center.
[0385] According to an embodiment, predetermined information for identifying a coding unit at a predetermined position can be obtained from a predetermined sample included in a coding unit to be determined. Referring to Figure 13 , the video decoding apparatus 100 can determine a coding unit at a predetermined position (e.g., a coding unit located at the center among a plurality of coding units) from a plurality of coding units 1320a, 1320b, and 1320c determined by division of the current coding unit 1300 using at least one of the block shape information and the partition shape information obtained from a sample at a predetermined position in the current coding unit 1300 (e.g., a sample located at the center of the current coding unit 1300). In other words, the video decoding apparatus 100 can determine the sample at the predetermined position in consideration of the block shape of the current coding unit 1300, and the video decoding apparatus 100 determines the coding unit 1320b including the sample at which predetermined information (e.g., at least one of the block shape information and the partition shape information) can be obtained from among a plurality of coding units 1320a, 1320b, and 1320c determined by division of the current coding unit 1300 and sets a predetermined restriction thereon. Referring to Figure 13According to an embodiment, the video decoding apparatus 100 can determine a sample located at the center of the current coding unit 1300 as a sample from which predetermined information is obtainable, and set a predetermined restriction on a coding unit 1320b including such a sample 1340 during a decoding process. However, the location of the sample from which the predetermined information is obtainable should not be construed as being limited to the above-described location, and can be construed as a sample at an arbitrary location included in the coding unit 1320b determined for setting the restriction.
[0386] According to an embodiment, the location of the sample from which the predetermined information is obtainable can be determined according to the shape of the current coding unit 1300. According to an embodiment, block shape information can determine whether the shape of the current coding unit is a square or a non-square, and the location of the sample from which the predetermined information is obtainable is determined according to the shape. For example, the video decoding apparatus 100 can determine a sample located on a boundary that is a boundary dividing at least one of the width and height of the current coding unit into two halves by using at least one of information on the width and information on the height of the current coding unit as the sample from which the predetermined information is obtainable. As another example, when the block shape information related to the current coding unit indicates a non-square shape, the video decoding apparatus 100 can determine one of samples adjacent to a boundary dividing a long side of the current coding unit into two halves as the sample from which the predetermined information is obtainable.
[0387] According to an embodiment, when the current coding unit is divided into a plurality of coding units, the video decoding apparatus 100 can determine a coding unit at a predetermined location from among the plurality of coding units using at least one of block shape information and division shape information. According to an embodiment, the video decoding apparatus 100 can obtain at least one of the block shape information and the division shape information from a sample at a predetermined location included in a coding unit, and the video decoding apparatus 100 can divide a plurality of coding units generated as the current coding unit is divided by using at least one of the division shape information and the block shape information obtained from a sample at a predetermined location included in each of the plurality of coding units. In other words, the coding units can be recursively divided by using at least one of the block shape information and the division shape information obtained from a sample at a predetermined location included in each coding unit. Since the process of recursively dividing the coding units has been described above with reference to FIGS. 2A to 2C, a detailed description thereof will be omitted. Figure 12 Since the process of recursively dividing the coding units has been described above with reference to FIGS. 2A to 2C, a detailed description thereof will be omitted.
[0388] According to an embodiment, the video decoding apparatus 100 can determine at least one coding unit by dividing the current coding unit, and determine an order in which the at least one coding unit is encoded according to a predetermined block (e.g., the current coding unit).
[0389] Figure 14FIG. 6 illustrates an order in which multiple coding units are processed when the video decoding device 100 determines the multiple coding units as the current coding unit is divided according to an embodiment.
[0390] According to an embodiment, the video decoding device 100 can determine the second coding units 1410a and 1410b by dividing the first coding unit 1400 in a vertical direction according to the block shape information and the division shape information, determine the second coding units 1430a and 1430b by dividing the first coding unit 1400 in a horizontal direction, or determine the second coding units 1450a, 1450b, 1450c, and 1450d by dividing the first coding unit 1400 in the vertical and horizontal directions.
[0391] Referring to FIG. 6, Figure 14 , the video decoding device 100 can determine an order such that the second coding units 1410a and 1410b determined by dividing the first coding unit 1400 in the vertical direction are processed in the horizontal direction 1410c. The video decoding device 100 can determine an order of processing the second coding units 1430a and 1430b determined by dividing the first coding unit 1400 in the horizontal direction as the vertical direction 1430c. The video decoding device 100 can determine the second coding units 1450a, 1450b, 1450c, and 1450d determined by dividing the first coding unit 1400 in the vertical and horizontal directions according to a predetermined order in which coding units located in one row are processed after coding units located in a next row are processed (e.g., a raster scan order or a z-scan order 1450e, etc.).
[0392] According to an embodiment, the video decoding device 100 can recursively divide coding units. Referring to FIG. 6, Figure 14 , the video decoding device 100 can determine multiple second coding units 1410a, 1410b, 1430a, 1430b, 1450a, 1450b, 1450c, and 1450d by dividing the first coding unit 1400, and recursively divide each of the determined multiple second coding units 1410a, 1410b, 1430a, 1430b, 1450a, 1450b, 1450c, and 1450d. The method of dividing the multiple coding units 1410a, 1410b, 1430a, 1430b, 1450a, 1450b, 1450c, and 1450d can correspond to the method of dividing the first coding unit 1400. Accordingly, each of the multiple coding units 1410a, 1410b, 1430a, 1430b, 1450a, 1450b, 1450c, and 1450d can be independently divided into multiple coding units. Referring to Figure 14The video decoding apparatus 100 can determine the second coding units 1410a and 1410b by dividing the first coding unit 1400 in the vertical direction, and in addition, determine each of the second coding units 1410a and 1410b to be divided or not to be divided independently.
[0393] According to an embodiment, the video decoding apparatus 100 can divide the left second coding unit 1410a into third coding units 1420a and 1420b in the horizontal direction, and can not divide the right second coding unit 1410b.
[0394] According to an embodiment, the order of processing coding units can be determined based on a division process of the coding units. In other words, the order of processing divided coding units can be determined based on the order of processing coding units before being divided. The video decoding apparatus 100 can determine the order of processing the third coding units 1420a and 1420b determined by dividing the left second coding unit 1410a independently of the right second coding unit 1410b. Since the third coding units 1420a and 1420b are determined by dividing the left second coding unit 1410a in the horizontal direction, the third coding units 1420a and 1420b can be processed in the vertical direction 1420c. In addition, since the order of processing the left second coding unit 1410a and the right second coding unit 1410b corresponds to the horizontal direction 1410c, the right second coding unit 1410b can be processed after the third coding units 1420a and 1420b included in the left second coding unit 1410a are processed in the vertical direction 1420c. The above description is a related process of determining the processing order of coding units according to coding units before being divided, but it should not be construed as being limited to the above embodiment, and various methods of independently processing coding units divided into various shapes in a predetermined order can be used.
[0395] Figure 15 FIG. 7 illustrates a process of determining that a current coding unit is to be divided into an odd number of coding units when the video decoding apparatus 100 cannot process coding units in a predetermined order according to an embodiment.
[0396] According to an embodiment, the video decoding apparatus 100 can determine that the current coding unit is to be divided into an odd number of coding units based on the obtained block shape information and the division shape information. Referring to FIG. 7, the video decoding apparatus 100 can determine that the current coding unit is to be divided into an odd number of coding units when the block shape information is a 2Nx2N shape and the division shape information is a 2Nx1N shape. Figure 15The first coding unit 1500 having a square shape can be divided into second coding units 1510a and 1510b having non-square shapes, and the second coding units 1510a and 1510b can be independently divided into third coding units 1520a, 1520b, 1520c, 1520d, and 1520e, respectively. According to an embodiment, the video decoding apparatus 100 can determine a plurality of third coding units 1520a and 1520b by dividing the left second coding unit 1510a among the second coding units 1510a and 1510b in a horizontal direction, and divide the right second coding unit 1510b into odd-numbered third coding units 1520c, 1520d, and 1520e.
[0397] According to an embodiment, the video decoding apparatus 100 can determine whether there is a coding unit divided into an odd number by determining whether the third coding units 1520a, 1520b, 1520c, 1520d, and 1520e can be processed in a predetermined order. Referring to Figure 15 , the video decoding apparatus 100 can determine the third coding units 1520a, 1520b, 1520c, 1520d, and 1520e by recursively dividing the first coding unit 1500. The video decoding apparatus 100 can determine whether there is a coding unit divided into an odd number among shapes in which the first coding unit 1500, the second coding units 1510a and 1510b, or the third coding units 1520a, 1520b, 1520c, 1520d, and 1520e are divided, based on at least one of block shape information and division shape information. For example, the right second coding unit 1510b among the second coding units 1510a and 1510b can be divided into odd-numbered third coding units 1520c, 1520d, and 1520e. An order in which a plurality of coding units included in the first coding unit 1500 are processed can be a predetermined order (e.g., a z-scan order 1530), and the video decoding apparatus 100 can determine whether the third coding units 1520c, 1520d, and 1520e, which are determined by dividing the right second coding unit 1510b into an odd number, satisfy a condition that can be processed in the predetermined order.
[0398] According to an embodiment, the video decoding apparatus 100 can determine whether the third coding units 1520a, 1520b, 1520c, 1520d, and 1520e included in the first coding unit 1500 satisfy a condition that can be processed according to a predetermined order, which is related to whether at least one of a width and a height of each of the second coding units 1510a and 1510b is halved according to a boundary of the third coding units 1520a, 1520b, 1520c, 1520d, and 1520e. For example, when the third coding units 1520a and 1520b determined by the height of the left second coding unit 1510a of a non-square shape being halved satisfy the condition, but it can be determined that the third coding units 1520c, 1520d, and 1520e do not satisfy the condition because the boundaries of the third coding units 1520c, 1520d, and 1520e determined by the right second coding unit 1510b being divided into three coding units cannot halve the width or the height of the right second coding unit 1510b, and the video decoding apparatus 100 can determine a disconnection of the scan order when the condition is not satisfied, and determine that the right second coding unit 1510b will be divided into an odd number of coding units based on the determination result. According to an embodiment, when divided into an odd number of coding units, the video decoding apparatus 100 can set a predetermined restriction on a coding unit at a predetermined position among the divided coding units, and since such a restriction or a predetermined position has been described above through various embodiments, a detailed description thereof is omitted.
[0399] Figure 16 FIG. illustrates a process of dividing the first coding unit 1600 to determine at least one coding unit by the video decoding apparatus 100 according to an embodiment. According to an embodiment, the video decoding apparatus 100 can divide the first coding unit 1600 based on at least one of the block shape information and the division shape information obtained by the obtainer. The first coding unit 1600 having a square shape can be divided into four coding units having a square shape or a plurality of coding units having a non-square shape. For example, referring to FIG. 16A, the first coding unit 1600 having a square shape can be divided into four coding units 1610a, 1610b, 1610c, and 1610d having a square shape. Figure 16When the block shape information indicates that the first coding unit 1600 is a square and the division shape information indicates division into non-square coding units, the video decoding apparatus 100 can divide the first coding unit 1600 into a plurality of non-square coding units. In detail, when the division shape information indicates that an odd number of coding units is determined by dividing the first coding unit 1600 in a horizontal direction or a vertical direction, the video decoding apparatus 100 can divide the first coding unit 1600 having a square shape into the odd number of coding units, i.e., the second coding units 1610a, 1610b, and 1610c determined by division in the vertical direction or the second coding units 1620a, 1620b, and 1620c determined by division in the horizontal direction.
[0400] According to an embodiment, the video decoding apparatus 100 can determine whether the second coding units 1610a, 1610b, 1610c, 1620a, 1620b, and 1620c included in the first coding unit 1600 satisfy a condition that can be processed in a predetermined order by group, in which the condition relates to whether at least one of the width and the height of the first coding unit 1600 is halved according to the boundaries of the second coding units 1610a, 1610b, 1610c, 1620a, 1620b, and 1620c. Referring to Figure 16 Since the boundaries of the second coding units 1610a, 1610b, and 1610c determined when the first coding unit 1600 having a square shape is divided in the vertical direction do not halve the width of the first coding unit 1600, it can be determined that the first coding unit 1600 does not satisfy the condition that can be processed in a predetermined order. Also, since the boundaries of the second coding units 1620a, 1620b, and 1620c determined when the first coding unit 1600 having a square shape is divided in the horizontal direction do not halve the height of the first coding unit 1600, it can be determined that the first coding unit 1600 does not satisfy the condition that can be processed in a predetermined order. The video decoding apparatus 100 can determine discontinuity of the scan order when such a condition is not satisfied, and determine that the first coding unit 1600 will be divided into an odd number of coding units based on the determination result. According to an embodiment, the video decoding apparatus 100 can set a predetermined restriction on a coding unit at a predetermined position among the odd number of coding units obtained by dividing the coding unit, and since such a restriction or the predetermined position has been described above through various embodiments, a detailed description thereof is omitted.
[0401] According to an embodiment, the video decoding apparatus 100 can determine coding units having various shapes by dividing a first coding unit.
[0402] Referring to Figure 16The video decoding apparatus 100 can divide the first coding unit 1600 having a square shape and the first coding units 1630 or 1650 having a non-square shape into coding units having various shapes.
[0403] Figure 17 FIG. 13 illustrates that, when the second coding units having a non-square shape determined by the video encoding apparatus 100 in dividing the first coding unit 1700 satisfy a predetermined condition, the shapes into which the second coding units can be divided are limited according to an embodiment.
[0404] According to an embodiment, the video decoding apparatus 100 can determine to divide the first coding unit 1700 having a square shape into the second coding units 1710a, 1710b, 1720a, and 1720b having a non-square shape based on at least one of the block shape information and the division shape information obtained by the obtainer. The second coding units 1710a, 1710b, 1720a, and 1720b can be independently divided. Accordingly, the video decoding apparatus 100 can determine whether to be divided into a plurality of coding units or not based on at least one of the block shape information and the division shape information regarding each of the second coding units 1710a, 1710b, 1720a, and 1720b. According to an embodiment, the video decoding apparatus 100 can determine the third coding units 1712a and 1712b by dividing the left second coding unit 1710a having a non-square shape determined by dividing the first coding unit 1700 in the vertical direction in the horizontal direction. Only when the left second coding unit 1710a is divided in the horizontal direction, the video decoding apparatus 100 can set a limitation so that the right second coding unit 1710b cannot be divided in the horizontal direction in the same direction in which the left second coding unit 1710a is divided. When the right second coding unit 1710b is divided in the same direction, i.e., the horizontal direction, to determine the third coding units 1714a and 1714b, the left second coding unit 1710a and the right second coding unit 1710b are independently divided in the horizontal direction to determine the third coding units 1712a, 1712b, 1714a, and 1714b, respectively. However, this is the same result as dividing the first coding unit 1700 into the four second coding units 1730a, 1730b, 1730c, and 1730d having a square shape based on at least one of the block shape information and the division shape information, and this can be inefficient in terms of image decoding.
[0405] According to an embodiment, the video decoding apparatus 100 can determine the second coding units 1722a, 1722b, 1724a, and 1724b by dividing the first coding unit 1700, which has a non-square shape, in the vertical direction by dividing the first coding unit 1700 in the horizontal direction. Just when dividing one of the second coding units (for example, the upper end second coding unit 1720a) in the vertical direction, the video decoding apparatus 100 can set a limit due to the above-described reason so that the second coding unit 1720a (for example, the lower end coding unit 1720b) cannot be divided in the vertical direction in the same direction as the second coding unit 1720a is divided.
[0406] Figure 18 FIG. 7 illustrates a process in which the video decoding apparatus 100 divides a coding unit having a square shape when division shape information cannot indicate division into four coding units having a square shape, according to an embodiment.
[0407] According to an embodiment, the video decoding apparatus 100 can determine the second coding units 1810a, 1810b, 1820a, 1820b, etc. by dividing the first coding unit 1800 based on at least one of the block shape information and the division shape information. The division shape information can include information on various shapes into which a coding unit can be divided, but there can be a case where such information on various shapes does not include information for division into four coding units having a square shape. According to such division shape information, the video decoding apparatus 100 cannot divide the first coding unit 1800 having a square shape into four second coding units 1830a, 1830b, 1830c, and 1830d having a square shape. The video decoding apparatus 100 can determine the second coding units 1810a, 1810b, 1820a, 1820b, etc. having a non-square shape based on the division shape information.
[0408] According to an embodiment, the video decoding apparatus 100 can independently divide each of the second coding units 1810a, 1810b, 1820a, 1820b, etc. having a square shape. Each of the second coding units 1810a, 1810b, 1820a, 1820b, etc. can be divided in a predetermined order via a recursive method, which can be a division method corresponding to the method of dividing the first coding unit 1800 based on at least one of the block shape information and the division shape information.
[0409] For example, video decoding device 100 can determine third coding units 1812a and 1812b having a square shape by dividing the left second coding unit 1810a in the horizontal direction, or determine third coding units 1814a and 1814b having a square shape by dividing the right second coding unit 1810b in the horizontal direction. In addition, video decoding device 100 can determine third coding units 1816a, 1816b, 1816c, and 1816d having a square shape by dividing both the left second coding unit 1810a and the right second coding unit 1810b in the horizontal direction. In this case, the coding units can be determined in the same manner as when the first coding unit 1800 is divided into four second coding units 1830a, 1830a, 1830c, and 1830d having a square.
[0410] As yet another example, video decoding device 100 can determine third coding units 1822a and 1822b having a square shape by dividing the upper second coding unit 1820a in the vertical direction, and determine third coding units 1824a and 1824b having a square shape by dividing the lower second coding unit 1820b in the vertical direction. In addition, video decoding device 100 can determine third coding units 1822a, 1822b, 1824a, and 1824b having a square shape by dividing both the upper second coding unit 1820a and the lower second coding unit 1820b in the vertical direction. In this case, the coding units can be determined in the same manner as when the first coding unit 1800 is divided into four second coding units 1830a, 1830a, 1830c, and 1830d having a square.
[0411] Figure 19 The processing order between the plurality of coding units illustrated according to an embodiment can vary depending on the process of dividing the coding units.
[0412] According to an embodiment, video decoding device 100 can divide the first coding unit 1900 based on the block shape information and the division shape information. When the block shape information indicates a square shape and the division shape information indicates that the first coding unit 1900 is divided in at least one of a horizontal direction and a vertical direction, video decoding device 100 can divide the first coding unit 1900 to determine second coding units (e.g., 1910a, 1910b, 1920a, 1920b, 1930a, 1930b, 1930c, 1930d, etc.). Referring to Figure 19, the second coding units 1910a, 1910b, 1920a, and 1920b of non-square shapes determined by dividing the first coding unit 1900 in the horizontal direction or the vertical direction can be independently divided based on the block shape information and the division shape information thereon, respectively. For example, the video decoding apparatus 100 can determine the third coding units 1916a to 1916d by dividing each of the second coding units 1910a and 1910b generated by dividing the first coding unit 1900 in the vertical direction in the horizontal direction, or determine the third coding units 1926a, 1926b, 1926c, and 1926d by dividing the second coding units 1920a and 1920b generated by dividing the first coding unit 1900 in the horizontal direction in the horizontal direction. The process of dividing the second coding units 1910a, 1910b, 1920a, and 1920b has been described above with reference to FIGS. 19A and 19B, and thus a detailed description thereof will be omitted. Figure 17 The process of dividing the second coding units 1910a, 1910b, 1920a, and 1920b is described, and thus a detailed description thereof will be omitted.
[0413] According to an embodiment, the video decoding apparatus 100 can process the coding units according to a predetermined order. The feature of processing the coding units according to the predetermined order has been described above with reference to FIGS. 18A and 18B, and thus a detailed description thereof will be omitted. Figure 14 The feature of processing the coding units according to the predetermined order is described, and thus a detailed description thereof will be omitted. Reference is made to Figure 19 , the video decoding apparatus 100 can determine four third coding units 1916a, 1916b, 1916c, 1916d, 1926a, 1926b, 1926c, and 1926d having a square shape by dividing the first coding unit 1900 having a square shape. According to an embodiment, the video decoding apparatus 100 can determine the processing order of the third coding units 1916a, 1916b, 1916c, 1916d, 1926a, 1926b, 1926c, and 1926d based on the shape in which the first coding unit 1900 is divided.
[0414] According to an embodiment, the video decoding apparatus 100 can determine the third coding units 1916a, 1916b, 1916c, and 1916d by dividing the second coding units 1910a and 1910b generated by dividing the first coding unit 1900 in the vertical direction in the horizontal direction, and the video decoding apparatus 100 processes the third coding units 1916a, 1916b, 1916c, and 1916d in the order 1917 of first processing the third coding units 1916a and 1916b included in the left second coding unit 1910a in the vertical direction and then processing the third coding units 1916c and 1916d included in the right second coding unit 1910b in the vertical direction.
[0415] According to an embodiment, the video decoding apparatus 100 can determine the third coding units 1926a, 1926b, 1926c, and 1926d by dividing the first coding unit 1900, which is divided in the vertical direction, in the horizontal direction to generate second coding units 1920a and 1920b, and process the third coding units 1926a, 1926b, 1926c, and 1926d in an order 1927 of first processing the third coding units 1926a and 1926b included in the upper second coding unit 1920a in the vertical direction and then processing the third coding units 1926c and 1926d included in the lower second coding unit 1920b in the horizontal direction.
[0416] Referring to Figure 19 , the second coding units 1910a, 1910b, 1920a, and 1920b are all divided to determine the third coding units 1916a, 1916b, 1916c, 1916d, 1926a, 1926b, 1926c, and 1926d having a square shape. The second coding units 1910a and 1910b determined by division in the vertical direction and the second coding units 1920a and 1920b determined by division in the horizontal direction are divided into different shapes, but according to the third coding units 1916a, 1916b, 1916c, 1916d, 1926a, 1926b, 1926c, and 1926d determined thereafter, the first coding unit 1900 results in being divided into coding units having the same shape. Accordingly, even if coding units having the same shape are determined by recursively dividing coding units based on at least one of the block shape information and the division shape information through different processes, the video decoding apparatus 100 can process a plurality of coding units determined to have the same shape in different orders.
[0417] Figure 20 FIG. 7 illustrates a process of determining a depth of a coding unit as a shape and a size of a coding unit are changed when a plurality of coding units are determined by recursively dividing the coding unit according to an embodiment.
[0418] According to an embodiment, the video decoding apparatus 100 can determine a depth of a coding unit according to a predetermined criterion. For example, the predetermined criterion can be a length of a long side of the coding unit. When a length of a long side of a current coding unit is divided into 2n times a length before the long side of the coding unit is divided, the video decoding apparatus 100 can determine that the depth of the current coding unit is increased by n of the depth before the coding unit is divided, where n > 0. Hereinafter, a coding unit having an increased depth is referred to as a lower depth coding unit.
[0419] Referring to Figure 20According to one embodiment, the video decoding device 100 can determine the next lower-level encoding units 2002, third encoding units 2004, etc., by dividing a first encoding unit 2000 with a square shape based on block shape information indicating a square shape (e.g., the block shape information may indicate "0: SQUARE"). When the size of the first encoding unit 2000 with a square shape is 2N×2N, the width and height of the first encoding unit 2000 are divided by 1 / 2. 1 The second coding unit 2002, determined by dividing the width and height of the second coding unit 2002 into half, can have a size of N×N. Furthermore, the third coding unit 2004, determined by dividing the width and height of the second coding unit 2002 into half, can have a size of N / 2×N / 2. In this case, the width and height of the third coding unit 2004 correspond to half the size of the first coding unit 2000. 2 When the depth of the first coding unit 2000 is D, it has 1 / 2 the width and height of the first coding unit 2000. 1 The depth of the second coding unit can be D+1, and it has a width and a height of 1 / 2 that of the first coding unit 2000. 2 The depth of the third coding unit 2004 can be D+2.
[0420] According to one embodiment, the video decoding device 100 can determine a second encoding unit 2012 or 2022, a third encoding unit 2014 or 2024, etc., by dividing a first encoding unit 2010 or 2020 with a non-square shape based on block shape information indicating a non-square shape (for example, the block shape information may indicate "1: NS_VER" indicating a non-square shape with a height longer than its width or "2: NS_HOR" indicating a non-square shape with a width longer than its height).
[0421] The video decoding device 100 can determine a second coding unit (e.g., a second coding unit 2002, 2012, 2022, etc.) by dividing the width and height of a first coding unit 2010 with a size of N×2N. In other words, the video decoding device 100 can determine a second coding unit 2002 with a size of N×N or a second coding unit 2022 with a size of N×N / 2 by dividing the first coding unit 2010 in the horizontal direction, or determine a second coding unit 2012 with a size of N / 2×N by dividing the first coding unit 2010 in both the horizontal and vertical directions.
[0422] According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction.
[0423] According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction. 2 2 According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction.
[0424] According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction. 2 2 According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction.
[0425] According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction. 2 2 According to an embodiment, the video decoding device 100 can determine a third coding unit (e.g., third coding units 2004, 2014, 2024, etc.) by partitioning at least one of a width and a height of the second coding unit 2002 having a size of N x N. In other words, the video decoding device 100 can determine a third coding unit 2004 having a size of N / 2 x N / 2, a third coding unit 2014 having a size of N / 2 x N / 2, or a third coding unit 2024 having a size of N / 2 x N / 2 by partitioning the second coding unit 2002 in a vertical and horizontal direction.
[0426] According to an embodiment, the video decoding apparatus 100 can divide a coding unit having a square shape (e.g., 2000, 2002, 2004) in a horizontal or vertical direction. For example, a first coding unit 2000 having a size of 2N×2N can be divided in a vertical direction to determine a first coding unit 2010 having a size of N×2N, or can be divided in a horizontal direction to determine a first coding unit 2020 having a size of 2N×N. According to an embodiment, when a depth is determined based on a length of a longest side of a coding unit, the depth of a coding unit determined by dividing the first coding unit 2000, 2002, or 2004 having a size of 2N×2N in a horizontal or vertical direction can be the same as the depth of the first coding unit 2000, 2002, or 2004.
[0427] According to an embodiment, the width and height of the third coding unit 2014 or 2024 can be 1 / 2 of the width and height of the first coding unit 2010 or 2020 2 When the depth of the first coding unit 2010 or 2020 is D, the depth of the second coding unit 2012 or 2022, which is 1 / 2 of the width and height of the first coding unit 2010 or 2020, can be D+1, and the depth of the third coding unit 2014 or 2024, which is 1 / 2 of the width and height of the first coding unit 2010 or 2020 2 may be D+2.
[0428] Figure 21 FIG. illustrates a depth that can be determined according to a shape and size of a coding unit and a part index (hereinafter, PID) for distinguishing a coding unit according to an embodiment.
[0429] According to an embodiment, the video decoding apparatus 100 can determine second coding units having various shapes by dividing a first coding unit 2100 having a square shape. Referring to Figure 21 , the video decoding apparatus 100 can determine second coding units 2102a, 2102b, 2104a, 2104b, 2106a, 2106b, 2106c, and 2106d by dividing the first coding unit 2100 in at least one of a vertical direction and a horizontal direction according to division shape information. In other words, the video decoding apparatus 100 can determine the second coding units 2102a, 2102b, 2104a, 2104b, 2106a, 2106b, 2106c, and 2106d based on the division shape information of the first coding unit 2100.
[0430] According to an embodiment, depths of the second coding units 2102a, 2102b, 2104a, 2104b, 2106a, 2106b, 2106c, and 2106d determined with respect to the partition shape information of the first coding unit 2100 having a square shape can be determined based on a length of a long side. For example, because a length of a side of the first coding unit 2100 having a square shape is the same as a length of a long side of the second coding units 2102a, 2102b, 2104a, and 2104b having a non-square shape, depths of the first coding unit 2100 and the second coding units 2102a, 2102b, 2104a, and 2104b having a non-square shape can be considered to be the same depth D. On the other hand, when the video decoding apparatus 100 partitions the first coding unit 2100 into four second coding units 2106a, 2106b, 2106c, and 2106d having a square shape based on the partition shape information, a length of a side of the second coding units 2106a, 2106b, 2106c, and 2106d having a square shape is 1 / 2 of a length of a side of the first coding unit 2100, and thus a depth of the second coding units 2106a, 2106b, 2106c, and 2106d can be one depth, i.e., D+1, deeper than the depth D of the first coding unit 2100.
[0431] According to an embodiment, the video decoding apparatus 100 can partition the first coding unit 2110 having a longer height than width in a horizontal direction into a plurality of second coding units 2112a and 2112b or 2114a, 2114b, and 2114c according to the partition shape information. According to an embodiment, the video decoding apparatus 100 can partition the first coding unit 2120 having a longer width than height in a vertical direction into a plurality of second coding units 2122a and 2122b or 2124a, 2124b, and 2124c according to the partition shape information.
[0432] According to an embodiment, depths of the second coding units 2112a, 2112b, 2114a, 2114b, 2114c, 2122a, 2122b, 2124a, 2124b, and 2124c determined with respect to the partition shape information of the first coding unit 2110 or 2120 having a non-square shape can be determined based on a length of a long side. For example, because a length of a side of the second coding units 2112a and 2112b having a square shape is 1 / 2 of a length of a long side of the first coding unit 2110 having a non-square shape having a longer height than width, depths of the second coding units 2102a, 2102b, 2104a, and 2104b having a square shape are one depth, i.e., D+1, deeper than a depth D of the first coding unit 2110 having a non-square shape.
[0433] In addition, the video decoding apparatus 100 can divide the first coding unit 2110 having a non-square shape into an odd number of second coding units 2114a, 2114b, and 2114c based on the division shape information. The odd number of second coding units 2114a, 2114b, and 2114c can include second coding units 2114a and 2114c having a non-square shape and a second coding unit 2114b having a square shape. In this case, because the length of the long side of the second coding units 2114a and 2114c having a non-square shape and the length of one side of the second coding unit 2114b having a square shape are 1 / 2 of the length of one side of the first coding unit 2110, the depth of the second coding units 2114a, 2114b, and 2114c can be one depth deeper than the depth D of the first coding unit 2110, i.e., D+1. The video decoding apparatus 100 can determine the depth of coding units related to the first coding unit 2120 having a non-square shape in which the width is longer than the length in a manner corresponding to the above-described manner of determining the depth of coding units related to the first coding unit 2110.
[0434] According to an embodiment, in relation to determining an index (PID) for distinguishing coding units, when coding units divided into an odd number do not have the same size, the video decoding apparatus 100 can determine the index based on a size ratio between the coding units. Referring to Figure 21 , the second coding unit 2114b located at the center among the second coding units 2114a, 2114b, and 2114c divided into an odd number can have the same width as the other coding units 2114a and 2114c, but have a height twice as high as the other coding units 2114a and 2114c. In this case, the second coding unit 2114b located at the center can include two other coding units 2114a and 2114c. Accordingly, when the index (PID) of the coding unit 2114b located at the center is 1 according to the scanning order, the index of the coding unit 2114c located at the next order can be 3 increased by 2. In other words, the value of the index can be discontinuous. According to an embodiment, the video decoding apparatus 100 can determine whether coding units divided into an odd number have the same size based on the discontinuity of the index for distinguishing the coding units.
[0435] According to an embodiment, the video decoding apparatus 100 can determine whether to divide into a certain division shape based on the value of an index for distinguishing a plurality of coding units determined by dividing a current coding unit. Referring to Figure 21The video decoding apparatus 100 can determine even-numbered second coding units 2112a and 2112b or odd-numbered second coding units 2114a, 2114b, and 2114c by dividing the first coding unit 2110 having a rectangular shape with a height longer than a width. The video decoding apparatus 100 can distinguish a plurality of coding units using an index (PID) indicating each coding unit. According to an embodiment, the PID can be obtained from a sample at a predetermined position (e.g., a left upper end sample) of each coding unit.
[0436] According to an embodiment, the video decoding apparatus 100 can determine a coding unit at a predetermined position among coding units determined by division using an index for distinguishing the coding units. According to an embodiment, when the division shape information about the first coding unit 2110 having a rectangular shape with a height longer than a width indicates that the first coding unit 2110 is divided into three coding units, the video decoding apparatus 100 can divide the first coding unit 2110 into three coding units 2114a, 2114b, and 2114c. The video decoding apparatus 100 can assign an index to each of the three coding units 2114a, 2114b, and 2114c. The video decoding apparatus 100 can compare the indexes of the odd-numbered coding units to determine a center coding unit from among the coding units. The video decoding apparatus 100 can determine the second coding unit 2114b having an index corresponding to a center value among the indexes as a coding unit at a center position among the coding units determined by division of the first coding unit 2110 based on the indexes of the coding units. According to an embodiment, when determining the index for distinguishing the coding units, if the coding units do not have the same size, the video decoding apparatus 100 can determine the index based on a size ratio between the coding units. Referring to Figure 21When the second coding unit 2114b generated by dividing the first coding unit 2110 can have the same width as the other coding units 2114a and 2114c, but can have a height twice that of the other coding units 2114a and 2114c. In this case, when the index (PID) of the second coding unit 2114b located at the center is 1, the index of the coding unit 2114c located in the next order can be 3, which is increased by 2. Accordingly, in a case where the increase in the index becomes different when thus uniformly increased, the video decoding apparatus 100 can determine that the current coding unit is divided into a plurality of coding units including a coding unit having a different size from the other coding units. According to an embodiment, when the division shape information indicates division into an odd number of coding units, the video decoding apparatus 100 can divide the current coding unit into a shape of an odd number of coding units in which a coding unit (e.g., a center coding unit) at a predetermined position has a different size from the other coding units. In this case, the video decoding apparatus 100 can determine the center coding unit having a different size by using the index (PID) of the coding unit. However, the above-described index, the size or position of the coding unit to be determined at a predetermined position are specific for describing an embodiment, and should not be construed as being limited thereto, and various indexes of the coding unit and various positions and sizes can be used.
[0437] According to an embodiment, the video decoding apparatus 100 can use a predetermined data unit of which recursive division of a coding unit is started.
[0438] Figure 22 FIG. 13 illustrates determining a plurality of coding units according to a plurality of predetermined data units included in a picture according to an embodiment.
[0439] According to an embodiment, the predetermined data unit can be defined as a data unit in which a coding unit is recursively divided using at least one of block shape information and division shape information. In other words, the predetermined data unit can correspond to a coding unit of the uppermost depth used when a plurality of coding units are determined by dividing a current picture. Hereinafter, for convenience of description, the predetermined data unit is referred to as a reference data unit.
[0440] According to an embodiment, the reference data unit can indicate a predetermined size and shape. According to an embodiment, the reference data unit can include MxN samples. Here, M and N can be the same, and can be an integer expressed as a multiple of 2. In other words, the reference data unit can indicate a square shape or a non-square shape, and can be then divided into an integer number of coding units.
[0441] According to an embodiment, the video decoding apparatus 100 can divide the current picture into a plurality of reference data units. According to an embodiment, the video decoding apparatus 100 can divide the plurality of reference data units by using division shape information about each of the plurality of reference data units in which the current picture is divided. The division process of such reference data units can correspond to a division process using a quad-tree structure.
[0442] According to an embodiment, the video decoding apparatus 100 can determine in advance a minimum size that a reference data unit included in the current picture can have. Accordingly, the video decoding apparatus 100 can determine reference data units having various sizes equal to or greater than the minimum size, and determine at least one coding unit using block shape information and division shape information based on the determined reference data units.
[0443] Referring to Figure 22 , the video decoding apparatus 100 can use a reference coding unit 2200 having a square shape, or can use a reference coding unit 2202 having a non-square shape. According to an embodiment, the shape and size of the reference coding unit can be determined according to various data units (e.g., sequence, picture, slice, slice segment, and largest coding unit, etc.) in which at least one reference coding unit can be included.
[0444] According to an embodiment, the obtainer of the video decoding apparatus 100 can obtain at least one of information about the shape of the reference coding unit and information about the size of the reference coding unit from the bitstream according to various data units. The process of determining at least one coding unit included in the reference coding unit 2200 having a square shape has been described above through the process of dividing the current coding unit 1000, and the process of determining at least one coding unit included in the reference coding unit 2200 having a non-square shape has been described above through the process of dividing the current coding unit 1100 or 1150, and thus a detailed explanation thereof is omitted. Figure 10 Figure 11
[0445] According to an embodiment, in order to determine the size and shape of the reference coding unit according to some data units predetermined based on predetermined conditions, the video decoding apparatus 100 can use an index for distinguishing the size and shape of the reference coding unit. In other words, for each of the data units satisfying the predetermined conditions (e.g., data units having a size smaller than or equal to a slice) among the various data units (e.g., sequence, picture, slice, slice segment, and largest coding unit, etc.), the obtainer can obtain only an index for identifying the size and shape of the reference coding unit from the bitstream. The video decoding apparatus 100 can determine the size and shape of the reference data unit for each data unit satisfying the predetermined conditions by using the index. When the information on the shape of the reference coding unit and the information on the size of the reference coding unit are obtained from the bitstream according to the data unit having a relatively small size and used, the use efficiency of the bitstream can be insufficient, and thus, instead of directly obtaining the information on the shape of the reference coding unit and the information on the size of the reference coding unit, only the index can be obtained and used. In this case, at least one of the size and shape of the reference coding unit corresponding to the index indicating the size and shape of the reference coding unit can be predetermined. In other words, the video decoding apparatus 100 can select at least one of the size and shape of the reference coding unit predetermined according to the index in order to determine at least one of the size and shape of the reference coding unit included in the data unit as a criterion for obtaining the index.
[0446] According to an embodiment, the video decoding apparatus 100 can use at least one reference coding unit included in one largest coding unit. In other words, the largest coding unit partitioning the picture can include at least one reference coding unit, and the coding unit can be determined through a recursive partitioning process of each reference coding unit. According to an embodiment, at least one of the width and height of the largest coding unit can correspond to an integer multiple of at least one of the width and height of the reference coding unit. According to an embodiment, the size of the reference coding unit can be equal to the size of the largest coding unit partitioned n times according to a quad-tree structure. In other words, the video decoding apparatus 100 can determine the reference coding unit by partitioning the largest coding unit n times according to a quad-tree structure, and according to various embodiments, partition the reference coding unit based on at least one of the block shape information and the partition shape information.
[0447] Figure 23 FIG. 11 illustrates a processing block used as a reference for determining the determination order of the reference coding unit included in the picture 2300 according to an embodiment.
[0448] According to an embodiment, the video decoding apparatus 100 can determine at least one processing block that partitions a picture. The processing block is a data unit including at least one reference coding unit that partitions an image, and at least one reference coding unit included in the processing block can be determined in a predetermined order. In other words, the determined order of at least one reference coding unit determined in each processing block can correspond to one of various orders for determining the reference coding units, and the determined order of the reference coding units determined in each processing block can be different according to the processing blocks. The determined order of the reference coding units determined per processing block can be one of various orders such as a raster scan order, a Z-scan order, an N-scan order, a top-right diagonal scan order, a horizontal scan order, and a vertical scan order, etc., but the determinable order should not be construed as being limited to the above-described scan orders.
[0449] According to an embodiment, the video decoding apparatus 100 can determine the size of at least one processing block included in an image by obtaining information about the size of the processing block. The video decoding apparatus 100 can obtain the information about the size of the processing block from a bitstream to determine the size of at least one processing block included in an image. The size of the processing block can be a predetermined size of a data unit indicated by the information about the size of the processing block.
[0450] According to an embodiment, the obtainer of the video decoding apparatus 100 can obtain the information about the size of the processing block from a bitstream in a predetermined data unit. For example, the information about the size of the processing block can be obtained from a bitstream in a data unit of an image, a sequence, a picture, a slice, a slice segment, etc. In other words, the obtainer can obtain the information about the size of the processing block from a bitstream according to several data units, and the video decoding apparatus 100 can determine the size of at least one processing block that partitions a picture by using the obtained information about the size of the processing block, and such a size of the processing block can be an integer multiple of the size of the reference coding unit.
[0451] According to an embodiment, the video decoding apparatus 100 can determine the sizes of the processing blocks 2302 and 2312 included in the picture 2300. For example, the video decoding apparatus 100 can determine the sizes of the processing blocks based on the information about the sizes of the processing blocks obtained from a bitstream. Referring to Figure 23 , according to an embodiment, the video decoding apparatus 100 can determine the horizontal size of the processing blocks 2302 and 2312 to be four times the horizontal size of the reference coding unit, and determine the vertical size thereof to be four times the vertical size of the reference coding unit. The video decoding apparatus 100 can determine the order in which at least one reference coding unit is determined within at least one processing block.
[0452] According to an embodiment, the video decoding apparatus 100 can determine each of the processing blocks 2302 and 2312 included in the picture 2300 based on a size of the processing block, and determine an order of determination of at least one reference coding unit included in the processing blocks 2302 and 2312. According to an embodiment, the determination of the reference coding unit can include determining a size of the reference coding unit.
[0453] According to an embodiment, the video decoding apparatus 100 can obtain information about an order of determination of at least one reference coding unit included in at least one processing block from a bitstream, and determine an order in which the at least one coding unit is determined based on the obtained information about the order of determination. The information about the order of determination can be defined as an order or a direction in which the reference coding unit is determined in the processing block. In other words, the order in which the reference coding unit is determined can be independently determined per processing block.
[0454] According to an embodiment, the video decoding apparatus 100 can obtain information about an order of determination of a reference coding unit from a bitstream in a predetermined data unit. For example, the obtainer can obtain the information about the order of determination of the reference coding unit from the bitstream in a data unit such as a picture, a sequence, a picture, a slice, a slice segment, a processing block, etc. Since the information about the order of determination of the reference coding unit indicates an order in which the reference coding unit is determined within a processing block, the information about the order of determination can be obtained in a specific data unit including an integer number of processing blocks.
[0455] According to an embodiment, the video decoding apparatus 100 can determine at least one reference coding unit based on the determined order.
[0456] According to an embodiment, the obtainer can obtain the information about the order of determination of the reference coding unit from the bitstream as information about the processing blocks 2302 and 2312, and the video decoding apparatus 100 can determine an order of at least one reference coding unit included in the processing blocks 2302 and 2312, and determine at least one reference coding unit included in the picture 2300 according to the determined order of the coding unit. Referring to Figure 23The video decoding apparatus 100 can determine the determination order 2304 and 2314 of at least one reference coding unit related to the processing blocks 2302 and 2312, respectively, when information on the determination order of the reference coding unit is obtained per processing block. For example, the determination order of the reference coding unit related to the processing blocks 2302 and 2312 can be different from each other when information on the determination order of the reference coding unit is obtained per processing block. For example, the determination order of the reference coding unit related to the processing blocks 2302 and 2312 can be different from each other when information on the determination order of the reference coding unit is obtained per processing block. When the determination order 2304 related to the processing block 2302 is a raster scan order, the reference coding units included in the processing block 2302 can be determined according to the raster scan order. In contrast, when the determination order 2314 related to the processing block 2312 is an inverse order of the raster scan order, the reference coding units included in the processing block 2312 can be determined in the inverse order of the raster scan order.
[0457] According to an embodiment, the video decoding apparatus 100 can encode the determined at least one reference coding unit. The video decoding apparatus 100 can decode an image based on the reference coding unit determined through the above-described embodiments. Examples of a method of decoding the reference coding unit can include various methods of decoding an image.
[0458] According to an embodiment, the video decoding apparatus 100 can obtain and use block shape information indicating a shape of a current coding unit or partition shape information indicating a method of partitioning the current coding unit from a bitstream. The block shape information or the partition shape information can be included in the bitstream related to various data units. For example, the video decoding apparatus 100 can use the block shape information or the partition shape information included in a sequence parameter set, a picture parameter set, a video parameter set, a slice header, and a slice segment header. In addition, the video decoding apparatus 100 can obtain and use syntax corresponding to the block shape information or the partition shape information from a bitstream according to a maximum coding unit, a reference coding unit, and a processing block.
[0459] Up to now, the present disclosure has been described centering on various embodiments. It should be understood by those skilled in the art to which the present disclosure pertains that the present disclosure can be implemented in modified forms without departing from the essential characteristics of the present disclosure. Therefore, the disclosed embodiments should be considered in a descriptive sense only and not as a restrictive sense. The scope of the present disclosure is shown in the claims rather than the description described above, and all points of difference within the equivalent scope thereof should be interpreted as being included in the present disclosure.
[0460] Meanwhile, the embodiments of the present disclosure can be written as a computer program and can be implemented using a general-purpose digital computer that can execute the program using a computer-readable recording medium. Examples of the computer-readable recording medium include magnetic storage media (e.g., ROM, floppy disks, hard disks, etc.), optical recording media (e.g., CD-ROMs or DVDs), and the like.
Claims
1. A method of video decoding, comprising: obtaining, from a bitstream, x-axis coordinate information and y-axis coordinate information of a quadrilateral scanning region including one or more significant transform coefficients; determining, based on whether a first position in the quadrilateral scanning region is equal to a position corresponding to the x-coordinate and the y-coordinate, and based on a number of non-zero transform coefficients among previously obtained transform coefficients, a context model for flag information of the first position, wherein the x-coordinate corresponds to the x-axis coordinate information, the y-coordinate corresponds to the y-axis coordinate information, and the flag information indicates whether a transform coefficient is zero; obtaining the flag information of the first position using the context model; determining a transform coefficient of the first position based on the flag information of the first position; generating a residual block using the transform coefficient of the first position; and recovering a current block based on the generated residual block.
2. A method of video encoding, comprising: obtaining transform coefficients of a current block; determining x-coordinates and y-coordinates of a quadrilateral scanning region including one or more significant transform coefficients in the current block; determining, based on whether a first position in the quadrilateral scanning region is equal to a position corresponding to the x-coordinate and the y-coordinate, and based on a number of non-zero transform coefficients among previously obtained transform coefficients, a context model for flag information of the first position, wherein the flag information indicates whether a transform coefficient is zero; entropy encoding the flag information using the context model; and generating a bitstream including x-axis coordinate information corresponding to the x-coordinates and y-axis coordinate information corresponding to the y-coordinates.
3. A method for transmitting a bitstream, comprising: generating the bitstream by the method of video encoding of claim 2; and transmitting the bitstream.
Citation Information
Patent Citations
Coefficient groups and coefficient coding for coefficient scans
CN104221289A
Transform coefficient coding
CN104247420A