Hello, Video Codec
blog.tempus-ex.com
blog.tempus-ex.com
The newer way is to shift the current frame a little bit before doing the diff, hoping that the motion in the video moves the next frame in the same direction as the shifting direction. If the image of the current shifted frame coincides with the next frame, the diff produced should be very small. The output for the next frame then consists of the shifting direction+amount and the diff. The decoder can reverse the process by shifting the current frame by the direction and amount, and applying the diff to get to the next frame.
To find the optimized shifted diff, the codecs would try shifting none, left, right, up, down, and even upper-left/upper-right/etc. Then see which shifted direction produces the smallest diff and use that for compression. Encoding is so expensive because of all these searchings for the optimal compression.
[1] https://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method
The encoding algorithms are not written in stone, so to speak. If you can optimize motion estimation encoding using Lucas-Kanade, you can just write that into, say, the x264 encoder and so long as the output is complaint you can expect all existing decoders to play back just fine.
Decoding of course may not be so flexible for compatibility reasons, and of course software is much more malleable than hardware.
Are there video codecs which are (accidentally) Turing-complete?