Image encoding/decoding method and device using adaptive color transform, and method for transmitting bitstream
An image encoding/decoding method and device are provided. An image decoding method performed by an image decoding device according to the present disclosure may comprise the steps of: determining a prediction mode of the current block on the basis of prediction information obtained from a bitstream; on the basis of the prediction mode of the current block, obtaining a flag indicating whether a color space transform is applied to a residual sample of the current block; determining a quantization parameter of the current block on the basis of the flag; and determining a transform coefficient of the current block on the basis of the quantization parameter.
1. An image decoding method performed by an image decoding device, the method comprising:
determining a prediction mode of a current coding unit based on prediction information in a bitstream;
obtaining color space transform information, for applying color space transform to a residual sample of the current coding unit, based on the prediction mode;
deriving first quantization parameter for the current coding unit;
deriving final quantization parameter based on adding a value of the first quantization parameter for the current coding unit to a value of quantization parameter offset for the current coding unit;
deriving transform coefficient for the current coding unit based on the final quantization parameter for the current coding unit; and
deriving the residual sample for the current coding unit based on the transform coefficient for the current coding unit;
wherein the current coding unit comprises a luma component block, first color component block, and second color component block,
wherein based on the color space transform information indicating not applying the color space transform to the residual sample of the current coding unit, values of the quantization parameter offsets for the luma component block, the first color component block, and the second color component block of the current coding unit are derived as 0, respectively,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit:
the values of the quantization parameter offsets for the luma component block, the first color component block, and the second color component block of the current coding unit are derived to be different from each other,
the values of the residual samples for the luma component block, the first color component block, and the second color component block are respectively updated based on the value of the residual sample for the luma component block,
the value of the residual sample for the first color component block is updated based on subtracting a first value and a second value from the value of the residual sample for the luma component block, wherein the first value is a value obtained by applying right shift operation to the value of the residual sample for the first color component block, and the second value is a value obtained by applying right shift operation to the value of the residual sample for the second color component block,
the value of the residual sample for the second color component block is updated based on adding the updated value of the residual sample for the first color component block and the value of the residual sample for the second color component block.
2. The method of claim 1 ,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit, the value of the quantization parameter offset of the luma component block is derived as a negative value.
3. The method of claim 1 ,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit, the value of the quantization parameter offset of the luma component block is derived as −5.
4. The method of claim 1 ,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit, the value of the quantization parameter offset of the first color component block is derived as 1.
5. The method of claim 1 ,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit, the value of the quantization parameter offset of the second color component block is derived as 3.
6. The method of claim 1 ,
wherein the first color component block is a chroma Cb block and the second color component block is a chroma Cr block.
7. The method of claim 1 ,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit, the value of the residual samples for the luma component block, the first color component block, and the second color component block are updated further based on sample value obtained by applying right shift operation to the value of the residual sample for the first color component block.
8. The method of claim 7 ,
wherein the sample value obtained by applying the right shift operation to the value of the residual sample for the first color component block corresponds to a half value of the residual sample for the first color component block.
9. The method of claim 1 ,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit, the value of the residual sample for the luma component block is updated based on adding a sample value obtained by applying right shift operation to the value of the residual sample for the first color component block to the value of the residual sample for the luma component block.
10. The method of claim 9 ,
wherein the sample value obtained by applying the right shift operation to the value of the residual sample for the first color component block corresponds to a half value of the residual sample for the first color component block.
11. An image encoding method performed by an image encoding device, the method comprising:
determining a prediction mode of a current coding unit;
deriving color space transform being applied for a residual sample of the current coding unit based on the prediction mode;
deriving a residual sample of the current coding unit based on the color space transform being applied;
deriving transform coefficient for the residual sample of the current coding unit; and
performing a quantization based on the transform coefficient and a final quantization parameter for the current coding unit;
wherein color space transform information, for applying color space transform to the residual sample of the current coding unit is encoded in a bitstream,
wherein the final quantization parameter is derived based on adding a value of first quantization parameter for the current coding unit to a value of quantization parameter offset for the current coding unit,
wherein the current coding unit comprises a luma component block, first color component block, and second color component block,
wherein based on the color space transform information indicating not applying the color space transform to the residual sample of the current coding unit, values of the quantization parameter offsets for the luma component block, the first color component block, and the second color component block of the current coding unit are derived as 0, respectively,
wherein based on the color space transform information indicating applying the color space transform to the residual sample of the current coding unit:
the values of the quantization parameter offsets for the luma component block, the first color component block, and the second color component block of the current coding unit are derived to be different from each other,
the values of the residual samples for the luma component block, the first color component block, and the second color component block are respectively updated based on the value of the residual sample for the luma component block,
the value of the residual sample for the first color component block is updated based on subtracting a first value and a second value from the value of the residual sample for the luma component block, wherein the first value is a value obtained by applying right shift operation to the value of the residual sample for the first color component block, and the second value is a value obtained by applying right shift operation to the value of the residual sample for the second color component block,
the value of the residual sample for the second color component block is updated based on adding the updated value of the residual sample for the first color component block and the value of the residual sample for the second color component block.
12. A non-transitory computer-readable medium storing the bitstream generated by the image encoding method of claim 11 .