summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-04-23 19:06:30 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-04-23 19:06:30 +0000
commitf4f3223ffd87e330910a49c45741920f25101285 (patch)
treec5dc7e3eeae5f133b80993c51dfee35978fb54c6 /libavcodec/mpegvideo.c
parent10f3005f51c4aed49abad7d882e1488225f1c674 (diff)
reuse motion vectors/mb types/field select values of the source video, if the SSE for a macroblock which is predicted with these values is below me_threshold
currently works only with mpeg1/2 source or some luck may need -sync 0 as otherwise framedrops could lead to extreemly long b frame sequences Originally committed as revision 3042 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 7e16b8d3cb..d92914bb66 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -295,7 +295,8 @@ static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *sr
if(!src->ref_index[0])
av_log(s->avctx, AV_LOG_ERROR, "AVFrame.ref_index not set!\n");
if(src->motion_subsample_log2 != dst->motion_subsample_log2)
- av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesnt match!\n");
+ av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesnt match! (%d!=%d)\n",
+ src->motion_subsample_log2, dst->motion_subsample_log2);
memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * sizeof(dst->mb_type[0]));
@@ -2055,11 +2056,12 @@ static void select_input_picture(MpegEncContext *s){
s->reordered_input_picture[0]->data[i]= NULL;
s->reordered_input_picture[0]->type= 0;
- copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]);
pic->reference = s->reordered_input_picture[0]->reference;
alloc_picture(s, pic, 0);
+ copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]);
+
s->current_picture_ptr= pic;
}else{
// input is not a shared pix -> reuse buffer for current_pix
@@ -4676,7 +4678,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
/* Estimate motion for every MB */
if(s->pict_type != I_TYPE){
- if(s->pict_type != B_TYPE){
+ 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);
}