Method and device for encoding/decoding images
A method and a device for encoding/decoding images are disclosed. The method for encoding images comprises the steps of: deriving a scan type of a residual signal for a current block according to whether or not the current block is a transform skip block; and applying the scan type to the residual signal for the current block, wherein the transform skip block is a block to which transform for the current block is not applied and is specified on the basis of information indicating whether or not transform for the current block is to be applied.
1. A video decoding method, comprising:
obtaining first information indicating whether a residual signal is present in a current block, the current block comprising one or more transform coefficient levels other than 0 when the first information indicates that the residual signal is present in the current block;
determining a transform type of the current block, based on second information indicating whether or not an inverse-transform based on discrete cosine transform (DCT) or discrete sine transform (DST) is allowed;
acquiring the residual signal of the current block based on a scanning direction for the residual signal of the current block, if the first information indicates that the residual signal is present in the current block; and
performing the inverse-transform on the residual signal of the current block based on the determined transform type,
wherein the scanning direction is determined based on the second information.
2. The video decoding method of claim 1 , wherein the scanning direction is determined based on the intra prediction mode of the current block, if the second information indicates that the inverse-transform based on DCT or DST is allowed.
3. The video decoding method of claim 2 , wherein the scanning direction is determined independently to the intra prediction mode of the current block, if the second information indicates that the inverse-transform based on DCT or DST is not allowed.
4. The video decoding method of claim 1 , wherein the scanning direction is determined to be one of a first direction, a second direction and a third direction, based on the intra prediction mode of the current block, if the second information indicates that the inverse-transform based on DCT or DST is allowed.
5. The video decoding method of claim 4 , wherein the second direction is a direction of columns of the current block, and the third direction is a direction of rows of the current block.
6. The video decoding method of claim 5 , wherein the scanning direction is determined to be the first direction, independently to the intra prediction mode of the current block, if the second information indicates that the inverse-transform based on the DCT or the DST is not allowed.
7. The video decoding method of claim 6 , wherein the second direction is more vertical than the first direction, and the third direction is more horizontal than the first direction.
8. The video decoding method of claim 1 , wherein the transform type of the current block is determined further based on a size of the current block.
9. The video decoding method of claim 8 , wherein each of a vertical type and a horizontal type for the transform type is determined to be one of types including DCT or DST, based on an intra prediction mode of the current block, if the second information indicates that the inverse-transform based on DCT or DST is allowed and the size of the current block is a first size.
10. The video decoding method of claim 9 , wherein the transform type is determined independently to the intra prediction mode of the current block, if the size of the current block is a second size, and
wherein the second size is not the same the first size, and the first size is 4×4.
11. The video decoding method of claim 9 , wherein the transform type of the current block is determined further based on third information indicating whether the current block is a luma block or a chroma block.
12. The video decoding method of claim 11 , wherein each of a vertical type and a horizontal type for the transform type is determined to be one of types including DCT or DST, based on an intra prediction mode of the current block, if the second information indicates that the inverse-transform based on DCT or DST is allowed, the size of the current block is the first size, and the third information indicates that the current block is the luma block.