[FFmpeg-cvslog] avfilter/delogo: Set default band to 1

Jean Delvare git at videolan.org
Thu Oct 8 11:29:12 CEST 2015


ffmpeg | branch: master | Jean Delvare <jdelvare at suse.de> | Wed Oct  7 15:03:32 2015 +0200| [8bc708fcee137ead6d0773fad8e24ab471ab2122] | committer: Stefano Sabatini

avfilter/delogo: Set default band to 1

The original interpolation algorithm behaved poorly on the borders and
did not even guarantee continuity at the borders. For this reason, a
second interpolation/blending pass was required on the borders to make
them seamless.

However, since the interpolation algorithm was improved in June 2013,
the border issues no longer exist. The new algorithm does guarantee
continuity at the borders, making the second pass useless. A larger
band always increases the cumulated interpolation error. In most cases
it also increases the average interpolation error, even though the
samples in the band are only partially interpolated.

For this reason I would like to get rid of the "band" parameter. As a
first step, let's change its default value from 4 to 1 and document it
as deprecated.

I have benchmarked this change on a combination of input sources and
realistic logo areas. Lowering the band value from 4 to 1 resulted in
8 to 39 % less interpolation error per frame (or 1 to 34 % less
interpolation error per luma sample.)

Signed-off-by: Jean Delvare <jdelvare at suse.de>
Signed-off-by: Stefano Sabatini <stefasab at gmail.com>

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

 doc/filters.texi        |    4 +++-
 libavfilter/vf_delogo.c |   17 +++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 47fd44d..506b5a6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4590,7 +4590,9 @@ specified.
 
 @item band, t
 Specify the thickness of the fuzzy edge of the rectangle (added to
- at var{w} and @var{h}). The default value is 4.
+ at var{w} and @var{h}). The default value is 1. This option is
+deprecated, setting higher values should no longer be necessary and
+is not recommended.
 
 @item show
 When set to 1, a green rectangle is drawn on the screen to simplify
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 3258493..c7fb6e3 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -165,8 +165,11 @@ static const AVOption delogo_options[]= {
     { "y",    "set logo y position",       OFFSET(y),    AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
     { "w",    "set logo width",            OFFSET(w),    AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
     { "h",    "set logo height",           OFFSET(h),    AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
-    { "band", "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, { .i64 =  4 },  1, INT_MAX, FLAGS },
-    { "t",    "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, { .i64 =  4 },  1, INT_MAX, FLAGS },
+#if LIBAVFILTER_VERSION_MAJOR < 7
+    /* Actual default value for band/t is 1, set in init */
+    { "band", "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, { .i64 =  0 },  0, INT_MAX, FLAGS },
+    { "t",    "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, { .i64 =  0 },  0, INT_MAX, FLAGS },
+#endif
     { "show", "show delogo area",          OFFSET(show), AV_OPT_TYPE_BOOL,{ .i64 =  0 },  0, 1,       FLAGS },
     { NULL }
 };
@@ -201,6 +204,16 @@ static av_cold int init(AVFilterContext *ctx)
     CHECK_UNSET_OPT(w);
     CHECK_UNSET_OPT(h);
 
+#if LIBAVFILTER_VERSION_MAJOR < 7
+    if (s->band == 0) { /* Unset, use default */
+        av_log(ctx, AV_LOG_WARNING, "Note: default band value was changed from 4 to 1.\n");
+        s->band = 1;
+    } else if (s->band != 1) {
+        av_log(ctx, AV_LOG_WARNING, "Option band is deprecated.\n");
+    }
+#else
+    s->band = 1;
+#endif
     av_log(ctx, AV_LOG_VERBOSE, "x:%d y:%d, w:%d h:%d band:%d show:%d\n",
            s->x, s->y, s->w, s->h, s->band, s->show);
 



More information about the ffmpeg-cvslog mailing list