diff mpegvideo.c @ 1955:5dafb10e0252 libavcodec

reuse motion vectors/mb types/field select values of the source video, if the SSE for a macroblock which is predicted with these values is below me_threshold currently works only with mpeg1/2 source or some luck may need -sync 0 as otherwise framedrops could lead to extreemly long b frame sequences
author michael
date Fri, 23 Apr 2004 19:06:30 +0000
parents d10578f7fd40
children 57ffe72703e0
line wrap: on
line diff
--- a/mpegvideo.c	Thu Apr 22 23:15:24 2004 +0000
+++ b/mpegvideo.c	Fri Apr 23 19:06:30 2004 +0000
@@ -295,7 +295,8 @@
         if(!src->ref_index[0])
             av_log(s->avctx, AV_LOG_ERROR, "AVFrame.ref_index not set!\n");
         if(src->motion_subsample_log2 != dst->motion_subsample_log2)
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesnt match!\n");
+            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesnt match! (%d!=%d)\n",
+            src->motion_subsample_log2, dst->motion_subsample_log2);
 
         memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * sizeof(dst->mb_type[0]));
         
@@ -2055,11 +2056,12 @@
                 s->reordered_input_picture[0]->data[i]= NULL;
             s->reordered_input_picture[0]->type= 0;
             
-            copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]);
             pic->reference              = s->reordered_input_picture[0]->reference;
             
             alloc_picture(s, pic, 0);
 
+            copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]);
+
             s->current_picture_ptr= pic;
         }else{
             // input is not a shared pix -> reuse buffer for current_pix
@@ -4676,7 +4678,7 @@
     
     /* Estimate motion for every MB */
     if(s->pict_type != I_TYPE){
-        if(s->pict_type != B_TYPE){
+        if(s->pict_type != B_TYPE && s->avctx->me_threshold==0){
             if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){
                 s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);
             }