[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec mpegvideo.c, 1.500, 1.501 mpegvideo.h, 1.230, 1.231

Michael Niedermayer CVS michael
Thu Dec 29 16:46:27 CET 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv14068/libavcodec

Modified Files:
	mpegvideo.c mpegvideo.h 
Log Message:
second try of improved lambda/qp guessing for motion estimation RD in first pass


Index: mpegvideo.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpegvideo.c,v
retrieving revision 1.500
retrieving revision 1.501
diff -u -d -r1.500 -r1.501
--- mpegvideo.c	25 Dec 2005 18:34:02 -0000	1.500
+++ mpegvideo.c	29 Dec 2005 15:46:23 -0000	1.501
@@ -1594,6 +1594,7 @@
     emms_c();
 
     s->last_pict_type    = s->pict_type;
+    s->last_lambda_for[s->pict_type]= s->current_picture_ptr->quality;
     if(s->pict_type!=B_TYPE){
         s->last_non_b_pict_type= s->pict_type;
     }
@@ -2204,7 +2205,7 @@
             int is_p= i % (j+1) == j || i==s->max_b_frames;
 
             input[i+1].pict_type= is_p ? P_TYPE : B_TYPE;
-            input[i+1].quality= s->rc_context.last_qscale_for[input[i+1].pict_type];
+            input[i+1].quality= s->last_lambda_for[input[i+1].pict_type];
             out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]);
             rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT;
         }
@@ -5398,12 +5399,10 @@
         estimate_qp(s, 1);
         ff_get_2pass_fcode(s);
     }else if(!(s->flags & CODEC_FLAG_QSCALE)){
-        RateControlContext *rcc= &s->rc_context;
-
         if(s->pict_type==B_TYPE)
-            s->lambda= rcc->last_qscale_for[s->pict_type];
+            s->lambda= s->last_lambda_for[s->pict_type];
         else
-            s->lambda= rcc->last_qscale_for[rcc->last_non_b_pict_type];
+            s->lambda= s->last_lambda_for[s->last_non_b_pict_type];
         update_qscale(s);
     }
 

Index: mpegvideo.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpegvideo.h,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -d -r1.230 -r1.231
--- mpegvideo.h	22 Dec 2005 22:48:09 -0000	1.230
+++ mpegvideo.h	29 Dec 2005 15:46:23 -0000	1.231
@@ -374,6 +374,7 @@
     int last_non_b_pict_type;   ///< used for mpeg4 gmc b-frames & ratecontrol
     int dropable;
     int frame_rate_index;
+    int last_lambda_for[5];     ///< last lambda for a specific pict type
 
     /* motion compensation */
     int unrestricted_mv;        ///< mv can point outside of the coded picture





More information about the ffmpeg-cvslog mailing list