As another example, a subblock-based mask as shown in FIG. 7 may be used and a weight may be applied at each position of the mask. A higher weight is applied at a position closer to the center of the subblock. For example, referring to FIG. 8, when the mask is applied on a pixel-by-pixel basis in the subblock, Δs for the same position may be redundantly calculated. Most of the pixels located within the mask 810a centered on the pixel at position (0, 0) of the subblock 820 are also located within the mask 810b centered on the pixel at position (1, 0) of the subblock 820. Therefore, Δs may be redundantly calculated. Instead of repeatedly calculating the overlap Δ, a weight may be assigned to each position in the mask according to the number of overlaps. For example, when M=2 and the size of the subblock is 4×4, a weighted mask as shown in FIG. 9 may be used. In this way, the operation of Equations 12 and 13 may be simplified, thereby reducing computational complexity.
The pixel-based or subblock-based BIO described above requires a large amount of computation. Therefore, a method for reducing the amount of computation according to BIO is required in video encoding or decoding. For this purpose, the present disclosure proposes that the BIO process be skipped in motion compensation when certain conditions are met.
FIG. 10 is a block diagram illustrating a configuration of a device configured to perform motion compensation by selectively applying a BIO process according to an embodiment of the present disclosure.