An image decoding method performed by a decoding apparatus, the method comprising: deriving quantized transform coefficients for a target block from a bitstream; deriving R transform coefficients through dequantization based on the quantized transform coefficients for the target block; deriving N modified transform coefficients based on an inverse reduced secondary transform, RST, for the R transform coefficients; deriving residual samples for the target block based on an inverse primary transform for the N modified transform coefficients; and generating a reconstructed picture based on the residual samples for the target block and prediction samples derived based on an intra prediction mode for the target block, wherein the inverse RST derives the N modified transform coefficients through a matrix operation of the R transform coefficients and a transform kernel matrix of size N x R, the number of the N modified transform coefficients is larger than the number of the R transform coefficients, and the N modified transform coefficients are arranged in a top-left area of the target block; wherein the inverse RST is performed based on the transform kernel matrix selected from a transform set including a plurality of transform kernel matrices, wherein the transform set is determined based on a mapping relationship according to the intra prediction mode applied to the target block, wherein a plurality of intra prediction modes including the intra prediction mode of the target block is mapped to the same single transform set, and characterized in that a size of the target block is 16x16 and the target block includes 16 of 4x4 unit blocks, the N modified transform coefficients are arranged on 10 of 4x4 unit blocks in the top-left area of the target block and the 10 of 4x4 unit blocks are from the top-left of the current block to the 10th 4x4 unit blocks in a forward diagonal scanning order. deriving quantized transform coefficients for a target block from a bitstream; deriving R transform coefficients through dequantization based on the quantized transform coefficients for the target block; deriving N modified transform coefficients based on an inverse reduced secondary transform, RST, for the R transform coefficients; deriving residual samples for the target block based on an inverse primary transform for the N modified transform coefficients; and generating a reconstructed picture based on the residual samples for the target block and prediction samples derived based on an intra prediction mode for the target block, wherein the inverse RST derives the N modified transform coefficients through a matrix operation of the R transform coefficients and a transform kernel matrix of size N x R, the number of the N modified transform coefficients is larger than the number of the R transform coefficients, and the N modified transform coefficients are arranged in a top-left area of the target block; wherein the inverse RST is performed based on the transform kernel matrix selected from a transform set including a plurality of transform kernel matrices, wherein the transform set is determined based on a mapping relationship according to the intra prediction mode applied to the target block, wherein a plurality of intra prediction modes including the intra prediction mode of the target block is mapped to the same single transform set, and characterized in that a size of the target block is 16x16 and the target block includes 16 of 4x4 unit blocks, the N modified transform coefficients are arranged on 10 of 4x4 unit blocks in the top-left area of the target block and the 10 of 4x4 unit blocks are from the top-left of the current block to the 10th 4x4 unit blocks in a forward diagonal scanning order.