]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
make zero motion vector threshold user setable
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 7 May 2006 11:48:07 +0000 (11:48 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 7 May 2006 11:48:07 +0000 (11:48 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@5348 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/avcodec.h
libavcodec/motion_est_template.c
libavcodec/utils.c

index 0ba573e5ba6845809de0c5f5bcbc5dae47a84c3b..a5eb93b008c9afe07ee783f08fcdc51851734b36 100644 (file)
@@ -1967,6 +1967,14 @@ typedef struct AVCodecContext {
      * - decoding: unused
      */
     int scenechange_factor;
+
+    /**
+     *
+     * note: value depends upon the compare functin used for fullpel ME
+     * - encoding: set by user.
+     * - decoding: unused
+     */
+    int mv0_threshold;
 } AVCodecContext;
 
 /**
index 23ead283c818f90fba38a78d3cfeeeca50b7e5c7..16d34bb8811c65a62e4987b90f098356811623c3 100644 (file)
@@ -896,7 +896,8 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
         CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
                         (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
     }else{
-        if(dmin<h*h && ( P_LEFT[0]    |P_LEFT[1]
+        if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
+                    && ( P_LEFT[0]    |P_LEFT[1]
                         |P_TOP[0]     |P_TOP[1]
                         |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
             *mx_ptr= 0;
index 3a26c6f94ab87927b10ce70f44ef0bf1b4e61edc..4fc81968fd1f098a11b025ace8c4de82ff75f600 100644 (file)
@@ -739,6 +739,7 @@ static AVOption options[]={
 {"partp8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P8X8, INT_MIN, INT_MAX, V|E, "partitions"},
 {"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_B8X8, INT_MIN, INT_MAX, V|E, "partitions"},
 {"sc_factor", NULL, OFFSET(scenechange_factor), FF_OPT_TYPE_INT, 6, 0, INT_MAX, V|E},
+{"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, 256, 0, INT_MAX, V|E},
 {NULL},
 };
 
@@ -793,6 +794,7 @@ void avcodec_get_context_defaults(AVCodecContext *s){
     s->frame_skip_cmp= FF_CMP_DCTMAX;
     s->nsse_weight= 8;
     s->sample_fmt= SAMPLE_FMT_S16; // FIXME: set to NONE
+    s->mv0_threshold= 256;
 
     s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
     s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;