[FFmpeg-cvslog] avcodec/snowenc: Support setting the iterative dia size separately

Michael Niedermayer git at videolan.org
Sun Aug 30 04:34:57 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Jul 24 20:50:55 2015 +0200| [4bd99f715de3ea54319d54f848d16186dd00b039] | committer: Michael Niedermayer

avcodec/snowenc: Support setting the iterative dia size separately

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bd99f715de3ea54319d54f848d16186dd00b039
---

 doc/encoders.texi    |    9 +++++++++
 libavcodec/snow.h    |    1 +
 libavcodec/snowenc.c |    4 +++-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 6e50a90..f9fe331 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1357,6 +1357,15 @@ allows to store non-rgb pix_fmts.
 
 @end table
 
+ at section snow
+
+ at subsection Options
+
+ at table @option
+ at item iterative_dia_size
+dia size for the iterative motion estimation
+ at end table
+
 @section libtheora
 
 libtheora Theora encoder wrapper.
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index a16ca0c..a09b622 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -177,6 +177,7 @@ typedef struct SnowContext{
     int no_bitstream;
     int intra_penalty;
     int motion_est;
+    int iterative_dia_size;
 
     MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)
 
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 9b5a488..5e5dc35 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1120,8 +1120,9 @@ static void iterative_me(SnowContext *s){
                     do{
                         int newx = block->mx;
                         int newy = block->my;
+                        int dia_size = s->iterative_dia_size ? s->iterative_dia_size : FFMAX(s->avctx->dia_size, 1);
                         dia_change=0;
-                        for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
+                        for(i=0; i < dia_size; i++){
                             for(j=0; j<i; j++){
                                 dia_change |= check_block_inter(s, mb_x, mb_y, newx+4*(i-j), newy+(4*j), obmc_edged, &best_rd);
                                 dia_change |= check_block_inter(s, mb_x, mb_y, newx-4*(i-j), newy-(4*j), obmc_edged, &best_rd);
@@ -1898,6 +1899,7 @@ static const AVOption options[] = {
     { "memc_only",      "Only do ME/MC (I frames -> ref, P frame -> ME+MC).",   OFFSET(memc_only), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
     { "no_bitstream",   "Skip final bitstream writeout.",                    OFFSET(no_bitstream), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
     { "intra_penalty",  "Penalty for intra blocks in block decission",      OFFSET(intra_penalty), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
+    { "iterative_dia_size",  "Dia size for the iterative ME",          OFFSET(iterative_dia_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
     { NULL },
 };
 



More information about the ffmpeg-cvslog mailing list