summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/avcodec.h3
-rw-r--r--libavcodec/motion_est.c13
-rw-r--r--libavcodec/mpegvideo.c9
3 files changed, 22 insertions, 3 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 492434f8fe..259515d8c5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -15,7 +15,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000408
#define FFMPEG_VERSION "0.4.8"
-#define LIBAVCODEC_BUILD 4682
+#define LIBAVCODEC_BUILD 4683
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION
@@ -215,6 +215,7 @@ static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed
#define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC
#define CODEC_FLAG_GMC 0x0020 ///< use GMC
+#define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0>
#define CODEC_FLAG_PART 0x0080 ///< use data partitioning
/* parent program gurantees that the input for b-frame containing streams is not written to
for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index a533b1bf95..52774d392f 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -830,6 +830,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int xmin, int ymin, int xma
int P[10][2];
int dmin_sum=0, mx4_sum=0, my4_sum=0;
uint8_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV;
+ int same=1;
for(block=0; block<4; block++){
int mx4, my4;
@@ -928,8 +929,13 @@ static inline int h263_mv4_search(MpegEncContext *s, int xmin, int ymin, int xma
s->motion_val[ s->block_index[block] ][0]= mx4;
s->motion_val[ s->block_index[block] ][1]= my4;
+
+ if(mx4 != mx || my4 != my) same=0;
}
+ if(same)
+ return INT_MAX;
+
if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*16*s->linesize, s->me.scratchpad, s->linesize);
}
@@ -1098,14 +1104,17 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
mb_type|= MB_TYPE_INTER;
s->me.sub_motion_search(s, &mx, &my, dmin, rel_xmin, rel_ymin, rel_xmax, rel_ymax,
pred_x, pred_y, &s->last_picture, 0, 0, mv_penalty);
+ if(s->flags&CODEC_FLAG_MV0)
+ if(mx || my)
+ mb_type |= MB_TYPE_SKIPED; //FIXME check difference
}else{
mx <<=shift;
my <<=shift;
}
if((s->flags&CODEC_FLAG_4MV)
&& !s->me.skip && varc>50 && vard>10){
- h263_mv4_search(s, rel_xmin, rel_ymin, rel_xmax, rel_ymax, mx, my, shift);
- mb_type|=MB_TYPE_INTER4V;
+ if(h263_mv4_search(s, rel_xmin, rel_ymin, rel_xmax, rel_ymax, mx, my, shift) < INT_MAX)
+ mb_type|=MB_TYPE_INTER4V;
set_p_mv_tables(s, mx, my, 0);
}else
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6387e18e37..baad534e85 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -3676,6 +3676,15 @@ static void encode_picture(MpegEncContext *s, int picture_number)
encode_mb_hq(s, &backup_s, &best_s, MB_TYPE_INTER, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
+ if(mb_type&MB_TYPE_SKIPED){
+ s->mv_dir = MV_DIR_FORWARD;
+ s->mv_type = MV_TYPE_16X16;
+ s->mb_intra= 0;
+ s->mv[0][0][0] = 0;
+ s->mv[0][0][1] = 0;
+ encode_mb_hq(s, &backup_s, &best_s, MB_TYPE_SKIPED, pb, pb2, tex_pb,
+ &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
+ }
if(mb_type&MB_TYPE_INTER4V){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_8X8;