changeset 2584:c07be5590462 libavcodec

motion estimation bitrate penalty compensation
author michael
date Sun, 27 Mar 2005 12:19:59 +0000
parents 61a08e2b9822
children 1ef8fab234c8
files avcodec.h mpegvideo.c utils.c
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Sun Mar 27 10:58:21 2005 +0000
+++ b/avcodec.h	Sun Mar 27 12:19:59 2005 +0000
@@ -17,7 +17,7 @@
 
 #define FFMPEG_VERSION_INT     0x000409
 #define FFMPEG_VERSION         "0.4.9-pre1"
-#define LIBAVCODEC_BUILD       4749
+#define LIBAVCODEC_BUILD       4750
 
 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
 #define LIBAVCODEC_VERSION     FFMPEG_VERSION
@@ -1781,6 +1781,13 @@
      * - decoding: unused
      */
     int mb_lmax;
+
+    /**
+     * 
+     * - encoding: set by user.
+     * - decoding: unused
+     */
+    int me_penalty_compensation;
 } AVCodecContext;
 
 
--- a/mpegvideo.c	Sun Mar 27 10:58:21 2005 +0000
+++ b/mpegvideo.c	Sun Mar 27 12:19:59 2005 +0000
@@ -5251,6 +5251,8 @@
 
     /* Estimate motion for every MB */
     if(s->pict_type != I_TYPE){
+        s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8;
+        s->lambda2= (s->lambda2* s->avctx->me_penalty_compensation + 128)>>8;
         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);
--- a/utils.c	Sun Mar 27 10:58:21 2005 +0000
+++ b/utils.c	Sun Mar 27 12:19:59 2005 +0000
@@ -458,6 +458,7 @@
     s->ildct_cmp= FF_CMP_VSAD;
     s->profile= FF_PROFILE_UNKNOWN;
     s->level= FF_LEVEL_UNKNOWN;
+    s->me_penalty_compensation= 256;
     
     s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
     s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;