Method and apparatus for processing video signal
A method for decoding a video according to the present invention may comprise: decoding information indicating whether a non-zero transform coefficient exists in a current block, when the information indicates that the non-zero transform coefficient exists in the current block, determining a scanning order of the current block, and decoding a transform coefficient included in the current block according to the determined scanning order.
1. A method for decoding a video, the method comprising:
decoding a coded block flag indicating whether a non-zero transform coefficient exists in a current block;
when the coded block flag indicates that at least one non-zero transform coefficient exists in the current block, decoding a transform coefficient of the current block, transform coefficients in the current block being decoded in a unit of a sub-block by applying a pre-determined scanning order; and
determining whether to skip an inverse-transform for the current block or not,
wherein:
whether to decode a transform skip flag, indicating whether to skip the inverse-transform or not, is determined based on a partition type of a coding block, and
wherein when the current block is one of partitions generated by partitioning the coding block either in a horizontal direction or in a vertical direction, decoding of the transform skip flag is omitted, and it is determined not to skip the inverse-transform for the current block.
2. A method for encoding a video, the method comprising:
determining whether to skip a transform for a current block or not;
when at least one non-zero transform coefficient exists in the current block, encoding a transform coefficient of the current block, transform coefficients in the current block being encoded in a unit of a sub-block by applying a pre-determined scanning order; and
encoding a coded block flag indicating whether the non-zero transform coefficient exists in the current block,
wherein:
whether to encode a transform skip flag indicting whether the transform is skipped or not is determined based on a partition type of a coding block, and
wherein when the current block is one of partitions generated by partitioning the coding block either in a horizontal direction or in a vertical direction, the transform is not skipped for the current block, and encoding of the transform skip flag is omitted.
3. A non-transitory computer-readable medium for storing data associated with a video signal, comprising:
a data stream stored in the non-transitory computer-readable medium, the data stream being encoded by an encoding method which comprising:
determining whether to skip a transform for a current block or not;
when at least one non-zero transform coefficient exists in the current block, encoding a transform coefficient of the current block, transform coefficients in the current block being encoded in a unit of a sub-block by applying a pre-determined scanning order; and
encoding a coded block flag indicating whether the non-zero transform coefficient exists in the current block,
wherein:
whether to encode a transform skip flag indicting whether the transform is skipped or not is determined based on a partition type of a coding block, and
wherein when the current block is one of partitions generated by partitioning the coding block either in a horizontal direction or in a vertical direction, the transform is not skipped for the current block, and encoding of the transform skip flag is omitted.
4. The method of claim 1 , wherein a shape of the sub-block is adaptively determined based on a shape of the current block when the current block is constituted with a pre-determined number of samples, and
wherein the pre-determined number is one of 16, 32 and 64.