Method and device for encoding/decoding image
A method and a device for encoding/decoding an image are disclosed. The method for decoding an image comprises the steps of: decoding information on a quantization matrix; and restoring the quantization matrix on the basis of the information on the quantization matrix, wherein the information on the quantization matrix includes information indicating a DC value of the quantization matrix and/or information indicating differential values of quantization matrix coefficients.
1. A video encoding method, comprising:
determining a quantization matrix; and
encoding information on the quantization matrix,
wherein the information on the quantization matrix includes at least one of information indicating a prediction method of the quantization matrix, information on a reference quantization matrix identifier of the quantization matrix, information representing a DC value of the quantization matrix, and information representing a difference value between quantization matrix coefficients;
wherein the encoding the information on the quantization matrix includes,
deriving an array of arranged quantization matrix coefficients by up-right diagonally scanning the quantization matrix coefficients in the quantization matrix; and
generating information representing a difference value between the arranged quantization matrix coefficients.
2. The video encoding method of claim 1 , wherein when a size of a transform coefficient block in which the quantization matrix is used is 16×16 or 32×32, the quantization matrix is reconstructed by using the information representing the DC value of the quantization matrix.
3. The video encoding method of claim 1 , wherein the information representing the DC value of the quantization matrix is decoded as a value of −7 to 247.
4. The video encoding method of claim 1 , wherein the information representing a difference value between the quantization matrix coefficients is a difference value between a current quantization matrix coefficient and a previous quantization matrix coefficient decoded before the current quantization matrix coefficient, and
the quantization matrix coefficient is derived by adding the previous quantization matrix coefficient to the difference value between the quantization matrix coefficients for the current quantization matrix coefficient.
5. The video encoding method of claim 1 ,
wherein when the quantization matrix is used in a transform coefficient block of 4×4 size, an up-right diagonal scan of 4×4 size is performed on the quantization matrix coefficients, and
when the quantization matrix is used in a transform coefficient block having one size of 8×8, 16×16, and 32×32, an up-right diagonal scan of 8×8 size is performed on the quantization matrix coefficients.
6. A non-transitory computer-readable recording medium storing a bitstream that is generated by a video encoding method, the method comprising:
determining a quantization matrix; and
encoding information on the quantization matrix,
wherein the information on the quantization matrix includes at least one of information indicating a prediction method of the quantization matrix, information on a reference quantization matrix identifier of the quantization matrix, information representing a DC value of the quantization matrix, and information representing a difference value between quantization matrix coefficients;
wherein the encoding the information on the quantization matrix includes,
deriving an array of arranged quantization matrix coefficients by up-right diagonally scanning the quantization matrix coefficients in the quantization matrix; and
generating information representing a difference value between the arranged quantization matrix coefficients.