A method of filtering a decoded block of video data, the method comprising:: determining a respective index value i c for each class C of 25 consecutive classes, wherein each index value i c identifies a set of filter coefficients f(k, l) which define a respective filter of a plurality of filters, wherein classes having the same index value i c use the same set of filter coefficients f(k,l); decoding a current block of the current picture; determining, for the current block, a vertical gradient g v, a horizontal gradient g h, a 45-degree diagonal gradient g d1, and a 135-degree diagonal gradient g d2, according to: g v = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 V k, l, where V k, l = 2 R k l − R k, l − 1 − R k, l + 1, g h = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 H k, l, where H k, l = 2 R k l − R k − 1, l − R k + 1, l, g d 1 = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 D 1 k, l, where D 1 k, l = 2 R k l − R k − 1, l − 1 − R k + 1, l + 1, g d 2 = ∑ k = i − M i + N + M − 1 ∑ j = j − M j + N + M − 1 D 2 k, l, where D 2 k, l = 2 R k l − R k − 1, l + 1 − R k + 1, l − 1; determining, for the current block, a directionality value D, wherein if both g h, v max ≤ t 1 ⋅ g h, v min and g d 0, d 1 max ≤ t 1 ⋅ g d 0, d 1 min, D is set to 0, wherein, if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min: if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min, D is set to 2, otherwise D is set to 1, otherwise: if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min, D is set to 4, otherwise D is set to 3, where g h, v max = max g h g v, g h, v min = min g h g v, g d 0, d 1 max = max g d 0 g d 1, and g d 0, d 1 min = min g d 0 g d 1, and where indices i and j refer to the coordinates of the upper left pixel in the current block, R(k,l) represents a reconstructed pixel with relative coordinates (k,l) to the top-left of the current block, and t 1 and t 2 are thresholds; determining an activity value A for the current block according to A = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 V k, l + H k, l, where A is further quantized to the range of 0 to 4 inclusively and the quantized value is denoted as Â; determining a class C for the current block according to C = 5D+ Â; selecting, based on the index value i c of the determined class C for the current block, a filter of the plurality of filters; and filtering at least one pixel of the current block using the selected filter. determining a respective index value i c for each class C of 25 consecutive classes, wherein each index value i c identifies a set of filter coefficients f(k, l) which define a respective filter of a plurality of filters, wherein classes having the same index value i c use the same set of filter coefficients f(k,l); decoding a current block of the current picture; determining, for the current block, a vertical gradient g v, a horizontal gradient g h, a 45-degree diagonal gradient g d1, and a 135-degree diagonal gradient g d2, according to: g v = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 V k, l, where V k, l = 2 R k l − R k, l − 1 − R k, l + 1, g h = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 H k, l, where H k, l = 2 R k l − R k − 1, l − R k + 1, l, g d 1 = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 D 1 k, l, where D 1 k, l = 2 R k l − R k − 1, l − 1 − R k + 1, l + 1, g d 2 = ∑ k = i − M i + N + M − 1 ∑ j = j − M j + N + M − 1 D 2 k, l, where D 2 k, l = 2 R k l − R k − 1, l + 1 − R k + 1, l − 1; determining, for the current block, a directionality value D, wherein if both g h, v max ≤ t 1 ⋅ g h, v min and g d 0, d 1 max ≤ t 1 ⋅ g d 0, d 1 min, D is set to 0, wherein, if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min: if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min, D is set to 2, otherwise D is set to 1, otherwise: if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min, D is set to 4, otherwise D is set to 3, if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min, D is set to 2, otherwise D is set to 1, otherwise: if g h, v max / g h, v min > g d 0, d 1 max / g d 0, d 1 min, D is set to 4, otherwise D is set to 3, where g h, v max = max g h g v, g h, v min = min g h g v, g d 0, d 1 max = max g d 0 g d 1, and g d 0, d 1 min = min g d 0 g d 1, and where indices i and j refer to the coordinates of the upper left pixel in the current block, R(k,l) represents a reconstructed pixel with relative coordinates (k,l) to the top-left of the current block, and t 1 and t 2 are thresholds; determining an activity value A for the current block according to A = ∑ k = i − M i + N + M − 1 ∑ l = j − M j + N + M − 1 V k, l + H k, l, where A is further quantized to the range of 0 to 4 inclusively and the quantized value is denoted as Â; determining a class C for the current block according to C = 5D+ Â; selecting, based on the index value i c of the determined class C for the current block, a filter of the plurality of filters; and filtering at least one pixel of the current block using the selected filter.