Adaptive algorithm for fast motion estimation in H.264/MPEG-4 AVC