Method for performing transform index coding on basis of intra prediction mode, and device therefor
The present disclosure, in a method of decoding a video signal, provides a method including checking whether a transform skip is applied to a current block; acquiring a transform index indicating transform types applied to a horizontal direction and a vertical direction of the current block from among a plurality of predefined transform types from the video signal when the transform skip is not applied to the current block; and performing an inverse primary transform on the current block using the transform types indicated by the transform index, wherein the transform types applied to the horizontal direction and the vertical direction of the current block are determined from among transform types defined according to an intra prediction mode of the current block based on the transform index.
1. A method for decoding an image, the method comprising:
obtaining a flag related to whether a transform skip is applied to a current block;
acquiring a transform index indicating a combination of transform types applied to a horizontal direction and a vertical direction of the current block based on the flag specifying that the transform is applied to the current block;
performing inverse transform on coefficients of the current block based on the combination of the transform types indicated by the transform index to generate residual samples of the current block; and
generating reconstructed samples of the current block based on the residual samples,
wherein different transform types are applied to the horizontal direction and the vertical direction, or the same transform types are applied to the horizontal direction and the vertical direction, and
wherein the transform index is binarized based on a truncated unary method.
2. The method of claim 1 , wherein the performing the inverse transform comprises:
determining a region in the current block to which transform has been applied based on the combination of the transform types indicated by the transform index and a size of the current block; and
performing the inverse transform on the region based on the combination of the transform types indicated by the transform index.
3. The method of claim 1 , wherein the transform index indicates one of combinations comprising two transform types selected among a plurality of predefined transform types.
4. The method of claim 1 , wherein the transform index indicates one among combinations of transform types defined in an intra mode group to which an intra prediction mode of the current block belongs, when intra prediction modes are grouped into a plurality of intra mode groups based on a prediction direction.
5. A method for encoding an image, the method comprising:
generating a residual block of a current block based on a prediction block of the current block;
determining whether to apply a transform to the residual block;
generating a transform index indicating a combination of transform types applied to a horizontal direction and a vertical direction of the residual block based on that it is determined that the transform is applied to the residual block;
performing the transform on the residual block based on the combination of the transform types indicated by the transform index; and
binarizing the transform index based on a truncated unary method, and
wherein different transform types are applied to the horizontal direction and the vertical direction, or the same transform types are applied to the horizontal direction and the vertical direction.
6. The method of claim 5 , wherein the performing the transform comprises:
determining a region in the residual block to which the transform is to be applied based on the combination of the transform types indicated by the transform index and a size of the current block; and
performing the transform on the region based on the combination of the transform types indicated by the transform index.
7. The method of claim 5 , wherein the transform index indicates one of combinations comprising two transform types selected among a plurality of predefined transform types.
8. The method of claim 5 , wherein the transform index indicates one among combinations of transform types defined in an intra mode group to which an intra prediction mode of the current block belongs, when intra prediction modes are grouped into a plurality of intra mode groups based on a prediction direction.
9. A method comprising:
generating a bitstream for a transform index binarized based on a truncated unary method, the transform index indicating a combination of transform types applied to a horizontal direction and a vertical direction of a residual block of a current block; and
transmitting the bitstream,
wherein the residual block of the current block is generated based on a prediction block of the current block,
wherein whether a transform is applied to the residual block is determined,
wherein the transform index is generated based on that it is determined that the transform is applied to the residual block, and
wherein the transform on the residual block is performed based on the combination of the transform types indicated by the transform index,
wherein different transform types are applied to the horizontal direction and the vertical direction, or the same transform types are applied to the horizontal direction and the vertical direction.