Method and device for processing video signal
Provided is a method for decoding a video signal. The method includes generating a first prediction sample by performing intra prediction on a current block, determining an intra prediction pattern of a current block, partitioning the current block into a plurality of sub-blocks based on the determined intra prediction pattern, generating a first prediction sample for a sub-block by performing intra prediction, determining an offset for the sub-block to obtain a second prediction sample, and generating the second prediction sample for the sub-block by using the first prediction sample and the offset.
1 . A method of decoding an image performed by a decoding device, comprising:
obtaining a residual coefficient of a current block in the image from a bitstream;
obtaining a residual sample of a current block by performing inverse-quantization and inverse-transform on the residual coefficient of the current block;
performing intra prediction on the current block to generate a first prediction sample of the current block;
obtaining a final prediction sample by modifying the first prediction sample of the current block using a second prediction sample of the current block; and
reconstructing the current block based on the residual sample and the modified first prediction sample,
wherein the final prediction sample is obtained by applying a first weight to the first prediction sample and a second weight to the second prediction sample, and
wherein the first weight and the second weight are determined based on whether a neighboring block adjacent to the current block is coded in intra prediction or inter prediction.
2 . The method of claim 1 , wherein the first weight to be applied to the first prediction sample when the neighboring block is coded in the intra prediction is greater than the first weight to be applied to the first prediction sample when the neighboring block is coded in the inter prediction.
3 . The method of claim 2 , wherein, in response to the neighboring block being coded in the intra prediction, the first weight to be applied to the first prediction sample is three times the second weight to be applied to the second prediction sample.
4 . The method of claim 3 , wherein the first prediction sample of the current block is generated based on one of intra prediction modes pre-defined in a decoding apparatus, and
wherein the intra prediction modes include a Planar mode, a DC mode, and directional modes.
5 . The method of claim 4 , wherein the neighboring block includes at least one of a top neighboring block or a left neighboring block.
6 . A method of encoding an image, comprising:
obtaining a residual sample of a current block in the image based on a difference between an original sample and a final prediction sample, the final prediction sample being obtained by modifying a first prediction sample of the current block using a second prediction sample of the current block, the first prediction sample being obtained by performing intra prediction on the current block;
performing transform and quantization on the residual sample of the current block to generate a residual coefficient of the current block; and
generating a bitstream by encoding the residual coefficient of the current block,
wherein the final prediction sample is obtained by applying a first weight to the first prediction sample and a second weight to the second prediction sample, and
wherein the first weight and the second weight are determined based on whether a neighboring block adjacent to the current block is coded in intra prediction or inter prediction.
7 . A non-transitory computer readable recording medium storing a program comprising instructions which, when executed by one or more processors, cause the processor to perform a method comprising:
obtaining a residual sample of a current block in the image based on a difference between an original sample and a final prediction sample, the final prediction sample being obtained by modifying a first prediction sample of the current block using a second prediction sample of the current block, the first prediction sample being obtained by performing intra prediction on the current block;
performing transform and quantization on the residual sample of the current block to generate a residual coefficient of the current block;
generating a bitstream by encoding the residual coefficient of the current block; and
transmitting the bitstream to a device for decoding a video,
wherein the final prediction sample is obtained by applying a first weight to the first prediction sample and a second weight to the second prediction sample, and
wherein the first weight and the second weight are determined based on whether a neighboring block adjacent to the current block is coded in intra prediction or inter prediction.