summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-03-27 12:19:59 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-03-27 12:19:59 +0000
commit09c3e44e8a2ab04bd6ed56888e7f412b24512f2b (patch)
treed067b22bc709979b65ff209880e2f634d08fed50 /libavcodec
parent048bfeeb12e9d0b8d7c5439deaada1ef6103a7bc (diff)
motion estimation bitrate penalty compensation
Originally committed as revision 4092 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h9
-rw-r--r--libavcodec/mpegvideo.c2
-rw-r--r--libavcodec/utils.c1
3 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c9251c6c13..b43dfc4aa7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -17,7 +17,7 @@ extern "C" {
#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 @@ typedef struct AVCodecContext {
* - decoding: unused
*/
int mb_lmax;
+
+ /**
+ *
+ * - encoding: set by user.
+ * - decoding: unused
+ */
+ int me_penalty_compensation;
} AVCodecContext;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 4dfd18c539..36bb267138 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -5251,6 +5251,8 @@ static void encode_picture(MpegEncContext *s, int picture_number)
/* 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);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 5c9c2425f8..afff2f98a8 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -458,6 +458,7 @@ void avcodec_get_context_defaults(AVCodecContext *s){
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;