A method of decoding a video, the method comprising: for a current block of the video, the current block comprising a plurality of sub-blocks: generating a motion vector of a sub-block , generating a sub-block based motion prediction signal using the motion vector of the sub-block, determining a set of pixel-level motion vector difference values associated with a sub-block of the current block, wherein a value of the pixel-level motion vector difference indicates a difference between a pixel-level motion vector obtained for a sample location in the sub-block and the motion vector of the sub-block , determining spatial gradients of the sub-block based motion prediction signal at each sample location of the sub-block, based on a difference between horizontally neighboring samples and a difference between vertically neighboring samples, determining a motion prediction refinement signal for the current block based on the determined set of pixel-level motion vector difference values and the determined spatial gradients, and combining the sub-block based motion prediction signal and the motion prediction refinement signal to produce a refined motion prediction signal for the current block; and decoding the video using the refined motion prediction signal, as the prediction for the current block, wherein the motion vector of the sub-block is generated and the set of pixel-level motion vector difference values is determined using an affine motion model for the current block. for a current block of the video, the current block comprising a plurality of sub-blocks: generating a motion vector of a sub-block , generating a sub-block based motion prediction signal using the motion vector of the sub-block, determining a set of pixel-level motion vector difference values associated with a sub-block of the current block, wherein a value of the pixel-level motion vector difference indicates a difference between a pixel-level motion vector obtained for a sample location in the sub-block and the motion vector of the sub-block , determining spatial gradients of the sub-block based motion prediction signal at each sample location of the sub-block, based on a difference between horizontally neighboring samples and a difference between vertically neighboring samples, determining a motion prediction refinement signal for the current block based on the determined set of pixel-level motion vector difference values and the determined spatial gradients, and combining the sub-block based motion prediction signal and the motion prediction refinement signal to produce a refined motion prediction signal for the current block; and generating a motion vector of a sub-block , generating a sub-block based motion prediction signal using the motion vector of the sub-block, determining a set of pixel-level motion vector difference values associated with a sub-block of the current block, wherein a value of the pixel-level motion vector difference indicates a difference between a pixel-level motion vector obtained for a sample location in the sub-block and the motion vector of the sub-block , determining spatial gradients of the sub-block based motion prediction signal at each sample location of the sub-block, based on a difference between horizontally neighboring samples and a difference between vertically neighboring samples, determining a motion prediction refinement signal for the current block based on the determined set of pixel-level motion vector difference values and the determined spatial gradients, and combining the sub-block based motion prediction signal and the motion prediction refinement signal to produce a refined motion prediction signal for the current block; and decoding the video using the refined motion prediction signal, as the prediction for the current block, wherein the motion vector of the sub-block is generated and the set of pixel-level motion vector difference values is determined using an affine motion model for the current block. <EOS>