Transform-based image coding method and device
An image decoding method includes a step of deriving a residual sample, wherein the step of deriving the residual sample includes the steps of: when a current block is divided into sub-partition blocks, deriving a transform kernel for an inverse primary transform applied to a sub-partition block based on a horizontal or a vertical length of the sub-partition block; and deriving the residual sample from transform coefficients based on the transform kernel.
1. An image decoding method performed by a decoding apparatus, the method comprising:
obtaining, from a bitstream, residual information and a low-frequency non-separable transform (LFNST) index;
deriving transform coefficients for a current block based on the residual information;
deriving residual samples for the current block by applying an inverse primary transform to the transform coefficients using transform kernels for vertical and horizontal; and
generating a reconstructed picture based on the residual samples,
wherein based on the current block being divided into sub-partition blocks as an intra sub-partitions (ISP) is applied and the LFNST index being equal to 0, the transform kernel for vertical is determined by checking a vertical length of a sub-partition block divided from the current block, and the transform kernel for horizontal is determined by checking a horizontal length of the sub-partition block, and
wherein based on the current block being divided into the sub-partition blocks as the ISP is applied and the LFNST index being greater than 0, the transform kernels for vertical and horizontal are respectively determined as DCT-2.
2. An image encoding method performed by an encoding apparatus, the method comprising:
deriving residual samples for a current block;
deriving transform coefficients by applying a primary transform to the residual samples using transform kernels for vertical and horizontal; and
encoding an LFNST index and residual information including information on the transform coefficients,
wherein based on the current block being divided into sub-partition blocks as an intra sub-partitions (ISP) is applied and the LFNST index being equal to 0, the transform kernel for vertical is determined by checking a vertical length of a sub-partition block divided from the current block, and the transform kernel for horizontal is determined by checking a horizontal length of the sub-partition block, and
wherein based on the current block being divided into the sub-partition blocks as the ISP is applied and the LFNST index being greater than 0, the transform kernels for vertical and horizontal are respectively determined as DCT-2.
3. A transmission method of data for an image, the method comprising:
obtaining a bitstream for the image, wherein the bitstream is generated based on deriving residual samples for a current block, deriving transform coefficients by applying a primary transform to the residual samples using transform kernels for vertical and horizontal, and encoding an LFNST index and residual information including information on the transform coefficients; and
transmitting the data comprising the bitstream,
wherein based on the current block being divided into sub-partition blocks as an intra sub-partitions (ISP) is applied and the LFNST index being equal to 0, the transform kernel for vertical is determined by checking a vertical length of a sub-partition block divided from the current block, and the transform kernel for horizontal is determined by checking a horizontal length of the sub-partition block, and
wherein based on the current block being divided into the sub-partition blocks as the ISP is applied and the LFNST index being greater than 0, the transform kernels for vertical and horizontal are respectively determined as DCT-2.