| CPC H04N 19/117 (2014.11) [H04N 19/105 (2014.11); H04N 19/132 (2014.11); H04N 19/176 (2014.11); H04N 19/186 (2014.11); H04N 19/1883 (2014.11); H04N 19/82 (2014.11)] | 11 Claims |

|
1. A method of decoding a video, the method comprising:
decoding a flag, indicating whether ALF (Adaptive Loop Filter) is applied to a coding tree block or not;
in response to the flag indicating that the ALF is applied to the coding tree block, classifying samples in the coding tree block into classes on a per block classification unit basis; and
applying filtering to the samples in the coding tree block,
wherein the block class indices are determined according to directionality information and activity information,
wherein at least one of the directionality information and the activity information is determined on the basis of a gradient value with respect to at least one of a vertical direction, a horizontal direction, a first directional direction, and a second directional direction,
wherein the gradient value is obtained using a one-dimensional Laplacian operation for the block classification unit,
wherein the one-dimensional Laplacian operation is performed only for a specific sample position included in the block classification unit, and
wherein a horizontal position and a vertical position of the specific sample are both even or both odd based on each block classification unit.
|