changeset 2980:529163f99474 libavcodec

improved lambda/qp guessing for motion estimation RD in first pass this only affects encoding with bframes and rate control
author michael
date Thu, 22 Dec 2005 14:17:54 +0000
parents bfabfdf9ce55
children 33d4fb0df0d3
files mpegvideo.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Thu Dec 22 01:10:11 2005 +0000
+++ b/mpegvideo.c	Thu Dec 22 14:17:54 2005 +0000
@@ -5300,7 +5300,15 @@
 
     if(s->flags & CODEC_FLAG_PASS2)
         estimate_qp(s, 1);
-
+    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];
+        else
+            s->lambda= rcc->last_qscale_for[rcc->last_non_b_pict_type];
+        update_qscale(s);
+    }
 
     s->mb_intra=0; //for the rate distortion & bit compare functions
     for(i=1; i<s->avctx->thread_count; i++){