Browse code

make zero motion vector threshold user setable

Originally committed as revision 5348 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2006/05/07 20:48:07
Showing 3 changed files
... ...
@@ -1967,6 +1967,14 @@ typedef struct AVCodecContext {
1967 1967
      * - decoding: unused
1968 1968
      */
1969 1969
     int scenechange_factor;
1970
+
1971
+    /**
1972
+     *
1973
+     * note: value depends upon the compare functin used for fullpel ME
1974
+     * - encoding: set by user.
1975
+     * - decoding: unused
1976
+     */
1977
+    int mv0_threshold;
1970 1978
 } AVCodecContext;
1971 1979
 
1972 1980
 /**
... ...
@@ -896,7 +896,8 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
896 896
         CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
897 897
                         (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
898 898
     }else{
899
-        if(dmin<h*h && ( P_LEFT[0]    |P_LEFT[1]
899
+        if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
900
+                    && ( P_LEFT[0]    |P_LEFT[1]
900 901
                         |P_TOP[0]     |P_TOP[1]
901 902
                         |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
902 903
             *mx_ptr= 0;
... ...
@@ -739,6 +739,7 @@ static AVOption options[]={
739 739
 {"partp8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P8X8, INT_MIN, INT_MAX, V|E, "partitions"},
740 740
 {"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_B8X8, INT_MIN, INT_MAX, V|E, "partitions"},
741 741
 {"sc_factor", NULL, OFFSET(scenechange_factor), FF_OPT_TYPE_INT, 6, 0, INT_MAX, V|E},
742
+{"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, 256, 0, INT_MAX, V|E},
742 743
 {NULL},
743 744
 };
744 745
 
... ...
@@ -793,6 +794,7 @@ void avcodec_get_context_defaults(AVCodecContext *s){
793 793
     s->frame_skip_cmp= FF_CMP_DCTMAX;
794 794
     s->nsse_weight= 8;
795 795
     s->sample_fmt= SAMPLE_FMT_S16; // FIXME: set to NONE
796
+    s->mv0_threshold= 256;
796 797
 
797 798
     s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
798 799
     s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;