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 of 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;
determining whether to skip an inverse-transform for the current block; and
obtaining residual samples of the current block by skipping or performing the inverse-transform on the transform coefficient in the current block,
wherein:
whether to decode a transform skip flag from a bitstream is determined based on a partition type of a coding block, the transform skip flag indicating whether to skip the inverse-transform, and
wherein when the current block is one of partitions generated by partitioning the coding block either in a horizontal direction or a vertical direction, decoding the transform skip flag from the bitstream is omitted, and it is determined not to skip the inverse-transform for the current block.
2. The method of claim 1 , wherein transform coefficients included in the current block are obtained based on a pre-defined scanning order, and
wherein the pre-defined scanning order is a diagonal scanning order.
3. The method of claim 2 , wherein the transform coefficients included in the current block are obtained in a unit of a sub-block,
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 16, 32 or 64.
4. The method of claim 1 , wherein when it is determined not to skip the inverse-transform, the method further comprises determining a horizontal transform type and a vertical transform type of the current block, and
wherein the horizontal transform type and the vertical transform type are determined as a DCT (Discrete Cosine Transform) basis kernel or a DST (Discrete Sine Transform) basis kernel.
5. A method of encoding a video, the method comprising:
obtaining residual samples of a current block;
obtaining transform coefficients by skipping or performing a transform on the residual samples of the current block;
when at least one non-zero transform coefficient exists in the current block, encoding a transform coefficient of the current block; 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 in a bitstream is determined based on a partition type of a coding block, the transform skip flag indicating whether the transform is skipped or not, and
wherein when the current block is one of partitions generated by partitioning the coding block either in a horizontal direction or a vertical direction, the transform is not skipped for the current block, and encoding the transform skip flag is omitted.
6. The method of claim 5 , wherein transform coefficients included in the current block are arranged in a line based on a pre-defined scanning order, and
wherein the pre-defined scanning order is a diagonal scanning order.
7. The method of claim 6 , wherein the transform coefficients included in the current block are encoded in a unit of a sub-block,
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 16, 32 or 64.
8. The method of claim 5 , wherein the method further comprises determining a horizontal transform type and a vertical transform type of the current block, and
wherein the horizontal transform type and the vertical transform type are determined as a DCT (Discrete Cosine Transform) basis kernel or a DST (Discrete Sine Transform) basis kernel.
9. A device of storing a compressed video data which being generated with program instructions, when the program instructions being executed, the device being configured to:
obtain residual samples of a current block;
obtain transform coefficients by skipping or performing a transform on the residual samples of the current block;
when at least one non-zero transform coefficient exists in the current block, encode a transform coefficient of the current block; and
encode a coded block flag indicating whether the non-zero transform coefficient exists in the current block,
wherein:
whether to encode a transform skip flag in a bitstream is determined based on a partition type of a coding block, the transform skip flag indicating whether the transform is skipped or not, and
wherein when the current block is one of partitions generated by partitioning the coding block either in a horizontal direction or a vertical direction, the transform is not skipped for the current block, and encoding the transform skip flag is omitted.