Image encoding/decoding method and device, and recording medium storing bitstream
The present invention relates to an image encoding and decoding method. An image decoding method for the same may include: obtaining transform coefficients of a current block from a bitstream; determining a scanning unit and a scanning order of the current block; and rearranging the transform coefficients of the current block by scanning the same base on the determined scanning unit and scanning order.
1 . A method of decoding an image, the method comprising:
obtaining transform coefficients for a current block; and
performing decoding for the current block based on the transform coefficients, wherein:
the current block is not a transform skip block,
a scanning unit of a current block is determined based on a size of the current block,
the transform coefficients are obtained according to a scanning order,
the transform coefficients are arranged by scanning the transform coefficients based on the scanning unit,
a specific diagonal scan mode is used for the scanning as the current block is not classified as a transform skip block,
the scanning unit is a coefficient group unit,
a size of the coefficient group unit is a first predetermined size representing a square shape in a case that the size of the current block is a second predetermined size representing a non-square shape,
the number of columns of a plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape, and
the number of rows of the plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape.
2 . The method of claim 1 , wherein the transform coefficients is an input of dequantization.
3 . The method of claim 1 ,
wherein scanning for a second transform coefficient is performed following scanning for a first transform coefficient according to the specific diagonal scan order,
wherein an x-coordinate of the second transform coefficient is smaller by 1 than an x-coordinate of the first transform coefficient, and
wherein a y-coordinate of the second transform coefficient is greater by 1 than a y-coordinate of the first transform coefficient.
4 . The method of claim 1 , wherein the specific diagonal scan mode uses a down-left diagonal scanning order.
5 . The method of claim 1 , wherein the scanning is performed according to a diagonal scanning order of the specific diagonal scan mode, and
wherein a direction of the diagonal scanning order is determined based on whether the current block is a transform skip block or not.
6 . A method of encoding an image, the method comprising:
obtaining transform coefficients for a current block; and
performing encoding for the current block based on the transform coefficients, wherein:
the current block is not a transform skip block,
a scanning unit of a current block is determined based on a size of the current block,
the transform coefficients are obtained according to a scanning order,
the transform coefficients are arranged by scanning the transform coefficients based on the scanning unit,
a specific diagonal scan mode is used for the scanning as the current block is not classified as a transform skip block,
the scanning unit is a coefficient group unit,
a size of the coefficient group unit is a first predetermined size representing a square shape in a case that the size of the current block is a second predetermined size representing a non-square shape,
the number of columns of a plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape, and
the number of rows of the plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape.
7 . The method of claim 6 , wherein:
scanning for a second transform coefficient is performed following scanning for a first transform coefficient according to the specific diagonal scan order,
an x-coordinate of the second transform coefficient is smaller by 1 than an x-coordinate of the first transform coefficient, and
a y-coordinate of the second transform coefficient is greater by 1 than a y-coordinate of the first transform coefficient.
8 . The method of claim 6 , wherein the specific diagonal scan mode uses a down-left diagonal scanning order.
9 . A method of storing a bitstream in a non-transitory computer-readable recording medium, the method comprising:
obtaining transform coefficients for a current block;
performing encoding for the current block based on the transform coefficients to generate encoded information; and
storing the bitstream comprising the encoded information in the non-transitory computer-readable recording medium, wherein
the current block is not a transform skip block,
a scanning unit of a current block is determined based on a size of the current block,
the transform coefficients are obtained according to a scanning order,
the transform coefficients are arranged by scanning the transform coefficients based on the scanning unit,
a specific diagonal scan mode is used for the scanning as the current block is not classified as a transform skip block,
the scanning unit is a coefficient group unit,
a size of the coefficient group unit is a first predetermined size representing a square shape in a case that the size of the current block is a second predetermined size representing a non-square shape,
wherein the number of columns of a plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape, and
wherein the number of rows of the plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape.
10 . The method of claim 9 , wherein:
scanning for a second transform coefficient is performed following scanning for a first transform coefficient according to the specific diagonal scan order,
an x-coordinate of the second transform coefficient is smaller by 1 than an x-coordinate of the first transform coefficient, and
a y-coordinate of the second transform coefficient is greater by 1 than a y-coordinate of the first transform coefficient.
11 . The method of claim 9 , wherein the specific diagonal scan mode uses a down-left diagonal scanning order.
12 . A method for sending a bitstream, the method comprising:
sending the bitstream to a video decoding apparatus to make the video decoding apparatus perform decoding for the current block,
wherein transform coefficients for a current block are obtained,
wherein the decoding for the current block is performed based on the transform coefficients,
wherein the current block is not a transform skip block,
wherein a scanning unit of a current block is determined based on a size of the current block,
wherein the transform coefficients are obtained according to a scanning order,
wherein the transform coefficients are arranged by scanning the transform coefficients based on the scanning unit,
wherein a specific diagonal scan mode is used for the scanning as the current block is not classified as a transform skip block,
the scanning unit is a coefficient group unit,
wherein a size of the coefficient group unit is a first predetermined size representing a square shape in a case that the size of the current block is a second predetermined size representing a non-square shape,
wherein the number of columns of a plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape, and
wherein the number of rows of the plurality of coefficient group units in the current block is greater than 1 in a case that the size of the current block is the second predetermined size representing a non-square shape.
13 . The method of claim 12 , wherein:
scanning for a second transform coefficient is performed following scanning for a first transform coefficient according to the specific diagonal scan order,
an x-coordinate of the second transform coefficient is smaller by 1 than an x-coordinate of the first transform coefficient, and
a y-coordinate of the second transform coefficient is greater by 1 than a y-coordinate of the first transform coefficient.
14 . The method of claim 12 , wherein the specific diagonal scan mode uses a down-left diagonal scanning order.