summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.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/mpegvideo.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/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index b2becd22bd..654e96f75e 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -5226,8 +5226,8 @@ static int encode_thread(AVCodecContext *c, void *arg){
}
}
- if(s->flags & CODEC_FLAG_QP_RD){
- if(best_s.mv_type==MV_TYPE_16X16 && !(best_s.mv_dir&MV_DIRECT)){
+ if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){
+ if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD
const int last_qp= backup_s.qscale;
int qpi, qp, dc[6];
DCTELEM ac[6][16];
@@ -5283,6 +5283,14 @@ static int encode_thread(AVCodecContext *c, void *arg){
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, mx, my);
}
+ if(mb_type&CANDIDATE_MB_TYPE_DIRECT0){
+ backup_s.dquant = 0;
+ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
+ s->mb_intra= 0;
+ ff_mpeg4_set_direct_mv(s, 0, 0);
+ encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
+ &dmin, &next_block, 0, 0);
+ }
s->current_picture.qscale_table[xy]= best_s.qscale;
copy_context_after_encode(s, &best_s, -1);