Transformation-based image coding method and device therefor
An image decoding method according to the present document comprises the steps of: determining whether or not an effective coefficient is present in a second area not including an upper-left first area of a current block; parsing an MTS index from a bitstream on the basis that the effective coefficient is not present in the second area; and deriving residual samples for the current block by applying a transform kernel, which is derived on the basis of the MTS index, to transform coefficients in the first area, wherein the MTS index can be parsed on the basis that the effective coefficient, which is present in a scan sub-block which is scanned for the effective coefficient, is not present in the second area.
1. An image decoding method performed by a decoding apparatus, the method comprising:
deriving a position of a last significant coefficient in a current block and transform coefficients for the current block based on residual information from a bitstream; and
deriving residual samples for the current block by applying a transform kernel derived based on a multiple transform selection (MTS) index related to an inverse primary transform to the transform coefficients;
wherein the deriving of the transform coefficient comprises:
parsing a flag related to whether a significant coefficient is present in a scan subblock by scanning the scan subblock in a preset scan subblock unit according to a reverse diagonal scan order;
determining whether the scan subblock belongs to a second region other than a top-left first region of the current block,
determining whether a color index of the current block indicates a luma component; and
deriving flag information related to whether the significant coefficient is present in the second region based on a value of the flag, whether the scan subblock belongs to the second region, and the color index,
wherein the MTS index is not parsed based on the flag information indicating that the significant coefficient is present in the second region, and
wherein a last scan subblock is derived based on the position of the last significant coefficient, and the scan subblock is scanned from the last scan subblock according to the reverse diagonal scan order.
2. The image decoding method of claim 1 , wherein the flag information is initially set to 1, and
wherein, the flag information is changed to 0 based on the value of the flag being 0, the scan subblock belonging to the second region, and the color index indicating the luma component.
3. The image decoding method of claim 2 , wherein when the flag information is changed to 0, the MTS index is not parsed, and
wherein the MTS index is inferred to 0 when the MTS index is not parsed.
4. The image decoding method of claim 1 , wherein the top-left first region is a top-left 16×16 region of the current block, and
wherein the scan subblock is a 4×4 block.
5. An image encoding method performed by an image encoding apparatus, the method comprising:
deriving residual samples for a current block based on prediction samples for the current block;
deriving transform coefficients for the current block based on a primary transform for the residual samples;
constructing image information to parse a multiple transform selection (MTS) index related to the primary transform based on a significant coefficient not being present in a second region other than a top-left first region of the current block; and
encoding residual information derived based on the transform coefficients for the current block and an MTS index,
whether the constructing of the image information comprise:
encoding a flag related to whether the significant coefficient is present in a scan subblock by scanning the scan subblock in a preset scan subblock unit according to a reverse diagonal scan order;
determining whether the scan subblock belongs to the second region;
determining whether a color index of the current block indicates a luma component; and
deriving flag information related to whether the significant coefficient is present in the second region based on a value of the flag, whether the scan subblock belongs to the second region, and the color index,
wherein the MTS index is not encoded based on the flag information indicating that the significant coefficient is present in the second region, and
wherein a last scan subblock is derived based on the position of a last significant coefficient in the current block, and the scan subblock is scanned from the last scan subblock according to the reverse diagonal scan order.
6. The image encoding method of claim 5 , wherein the flag information is initially set to 1, and
wherein, the flag information is changed to 0 based on the value of the flag being 0, the scan subblock belonging to the second region, and the color index indicating the luma component.
7. The image encoding method of claim 6 , wherein when the flag information is changed to 0, the MTS index is not encoded, and
wherein the MTS index is inferred to 0 when the MTS index is not encoded.
8. The image encoding method of claim 5 , wherein the top-left first region is a top-left 16×16 region of the current block, and
wherein the scan subblock is a 4×4 block.
9. A method of transmitting data for image information, the method comprising:
obtaining a bitstream for the image information, wherein the bitstream is generated based on deriving residual samples for a current block based on prediction samples for the current block; deriving transform coefficients for the current block based on a primary transform for the residual samples; constructing image information to parse a multiple transform selection (MTS) index related to the primary transform based on a significant coefficient not being present in a second region other than a top-left first region of the current block; and encoding residual information derived based on the transform coefficients for the current block and an MTS index to generate the bitstream, whether the constructing of the image information comprise: encoding a flag related to whether the significant coefficient is present in a scan subblock by scanning the scan subblock in a preset scan subblock unit according to a reverse diagonal scan order; determining whether the scan subblock belongs to the second region; determining whether a color index of the current block indicates a luma component and deriving flag information related to whether the significant coefficient is present in the second region based on a value of the flag, whether the scan subblock belongs to the second region, and the color index, wherein the MTS index is not encoded based on the flag information indicating that the significant coefficient is present in the second region, and wherein a last scan subblock is derived based on the position of a last significant coefficient in the current block, and the scan subblock is scanned from the last scan subblock according to the reverse diagonal scan order; and
transmitting the data including the bitstream.