A method for bi-directional motion compensation is provided. The method comprises:
adding the predicted error twice, the first predictor, and one to obtain a first
calculation result; wherein if the first calculation result is larger than a maximum
positive value storable in the register, either the maximum positive value or a
value of the maximum positive value minus one is stored in the register, otherwise
the first calculation result is stored in the register; adding the value stored
in the register and the second predictor to obtain a second calculation result;
wherein if the second calculation result is larger than the maximum positive value
storable in the register, either the maximum positive value or the value of the
maximum positive value minus one is stored in the register, if the second calculation
result is smaller than zero, a zero is stored in the register, otherwise the second
calculation result is stored in the register; right-shifting the value one bit
to obtain the pixel data.