changeset 271:997aac7d4e3e libavcodec

scene change detection
author michaelni
date Sun, 17 Mar 2002 19:45:33 +0000
parents 6b51689f6717
children 897dc7c6aa94
files mpegvideo.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Sun Mar 17 18:08:11 2002 +0000
+++ b/mpegvideo.c	Sun Mar 17 19:45:33 2002 +0000
@@ -487,7 +487,6 @@
     } else {
         s->pict_type = I_TYPE;
     }
-    avctx->key_frame = (s->pict_type == I_TYPE);
     
     MPV_frame_start(s);
     
@@ -518,6 +517,7 @@
     }
 
     encode_picture(s, s->picture_number);
+    avctx->key_frame = (s->pict_type == I_TYPE);
     
     MPV_frame_end(s);
     s->picture_number++;
@@ -1078,6 +1078,18 @@
         }
     }
 
+    if(s->avg_mb_var < s->mc_mb_var && s->pict_type != B_TYPE){ //FIXME subtract MV bits
+        int i;
+        s->pict_type= I_TYPE;
+        for(i=0; i<s->mb_height*s->mb_width; i++){
+            s->mb_type[i] = I_TYPE;
+            s->mv_table[0][i] = 0;
+            s->mv_table[1][i] = 0;
+        }
+    }
+        
+//    printf("%d %d\n", s->avg_mb_var, s->mc_mb_var);
+
     if (!s->fixed_qscale) 
         s->qscale = rate_estimate_qscale(s);