changeset 1426:b0f89a7855aa libavcodec

100l (forget to reset me.skip for b frames)
author michaelni
date Tue, 26 Aug 2003 22:26:18 +0000
parents f53d31c5eac9
children 3a6d613c88d8
files motion_est.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/motion_est.c	Tue Aug 26 22:05:12 2003 +0000
+++ b/motion_est.c	Tue Aug 26 22:26:18 2003 +0000
@@ -28,6 +28,7 @@
  
 #include <stdlib.h>
 #include <stdio.h>
+#include <limits.h>
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
@@ -1494,20 +1495,27 @@
     int fmin, bmin, dmin, fbmin;
     int type=0;
     
-    dmin= direct_search(s, mb_x, mb_y);
+    s->me.skip=0;
+    if (s->codec_id == CODEC_ID_MPEG4)
+        dmin= direct_search(s, mb_x, mb_y);
+    else
+        dmin= INT_MAX;
 
+    s->me.skip=0;
     fmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, &s->last_picture, s->f_code) + 3*penalty_factor;
+    
+    s->me.skip=0;
     bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, &s->next_picture, s->b_code) + 2*penalty_factor;
 //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
 
+    s->me.skip=0;
     fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor;
 //printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin);
     {
         int score= fmin;
         type = MB_TYPE_FORWARD;
         
-        // RAL: No MB_TYPE_DIRECT in MPEG-1 video (only MPEG-4)
-        if (s->codec_id == CODEC_ID_MPEG4 && dmin <= score){
+        if (dmin <= score){
             score = dmin;
             type = MB_TYPE_DIRECT;
         }