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 at least one non-zero transform coefficient exists in a current block;
decoding transform coefficients of the current block based on the coded block flag indicating that the at least one non-zero transform coefficient exists in the current block;
obtaining inverse-quantized transform coefficients by performing inverse-quantization on the transform coefficients of the current block;
determining, based on a transform skip flag indicating whether to skip inverse-transform, whether to skip the inverse-transform for the current block or not;
obtaining residual samples of the current block by skipping or performing the inverse-transform on the inverse-quantized transform coefficients in the current block; and
obtaining reconstruction sample by summing the residual samples and prediction samples,
wherein, in response to a case where the current block is one of two partitions generated by binary-partitioning a coding block in either a horizontal direction or a vertical direction, the transform skip flag is not parsed from a bitstream and it is determined not to skip the inverse-transform for the current block.
2 . The method of claim 1 , wherein the 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 units of sub-blocks,
wherein a shape of a 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 by subtracting prediction samples from original samples;
obtaining transform coefficients by skipping or performing transform on the residual samples of the current block;
obtaining quantized transform coefficients by performing quantization on the transform coefficients;
encoding the quantized transform coefficients of the current block;
encoding a coded block flag indicating whether a non-zero quantized transform coefficient exists in the current block,
wherein it is determined whether to encode a transform skip flag indicating whether the transform is skipped or not, and
wherein, in response to a case where the current block is one of two partitions generated by binary-partitioning a coding block in either a horizontal direction or a vertical direction, it is determined not to skip the transform for the current block and the transform skip flag is not encoded into a bitstream.
6 . The method of claim 5 , wherein the quantized transform coefficients included in the current block are encoded 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 quantized transform coefficients included in the current block are encoded in units of sub-blocks,
wherein a shape of a 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 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 comprising:
obtaining residual samples of a current block by subtracting prediction samples from original samples;
obtaining transform coefficients by skipping or performing transform on the residual samples of the current block;
obtaining quantized transform coefficients by performing quantization on the transform coefficients;
encoding the quantized transform coefficients of the current block; and
encoding a coded block flag indicating whether a non-zero quantized transform coefficient exists in the current block,
wherein it is determined whether to encode a transform skip flag indicating whether the transform is skipped or not, and
wherein, in response to a case where the current block is one of two partitions generated by binary-partitioning a coding block in either a horizontal direction or a vertical direction, it is determined not to skip the transform for the current block and the transform skip flag is not encoded into the data stream.