Since motion compensation is computationally expensive the search for matching blocks is restricted to a small region. In this paper an algorithm for searching all blocks in all previous frames in practical time is described.
Gary K. Arakaki,
"Video encoding using global block matching", Proc. SPIE 2187, Digital Video Compression on Personal Computers: Algorithms and Technologies, (2 May 1994); doi: 10.1117/12.174969; https://doi.org/10.1117/12.174969