diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 901fafdf260cf6d304664faba89cc5e4d7d8fb99..749af72035e00b87ca2e77311935f8a6fe0c508e 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -321,6 +321,9 @@ int ff_init_me(MpegEncContext *s){
 
     c->avctx= s->avctx;
 
+    if(s->codec_id == AV_CODEC_ID_H261)
+        c->avctx->me_sub_cmp = c->avctx->me_cmp;
+
     if(cache_size < 2*dia_size && !c->stride){
         av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n");
     }