summaryrefslogtreecommitdiff
path: root/libavcodec/motion_est.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-12-21 15:20:02 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-12-21 15:20:02 +0000
commit2f16af0667c7a7b2a706f416b65052c15f22d255 (patch)
treef9a1842024187267a738a7193b9424c46e4ddc3f /libavcodec/motion_est.c
parent59743d16c785276a93a031c9a330a9b932e60729 (diff)
skip motion estimation and encoding of non direct-0,0 MBs if the next MB is skiped (mpeg4 doesnt allow such MBs and in the past we did ME and encoding until at the end we droped them, so this should be faster though i didnt benchmark it, benchmark welcome)
Originally committed as revision 7343 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r--libavcodec/motion_est.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 94a0aa51dd..a5d5e57e69 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1843,6 +1843,18 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
get_limits(s, 16*mb_x, 16*mb_y);
c->skip=0;
+
+ if(s->codec_id == CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]){
+ int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0
+
+ score= ((unsigned)(score*score + 128*256))>>16;
+ c->mc_mb_var_sum_temp += score;
+ s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE
+ s->mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_DIRECT0;
+
+ return;
+ }
+
if(c->avctx->me_threshold){
int vard= check_input_motion(s, mb_x, mb_y, 0);