[FFmpeg-devel] [PATCH] lavfi: add tdiff filter

Stefano Sabatini stefasab at gmail.com
Fri Dec 26 11:39:54 CET 2014


On date Thursday 2014-12-11 10:18:51 +0000, Paul B Mahol encoded:
> On 12/10/14, Clement Boesch <u at pkh.me> wrote:
> > Oups, sorry about the delay, I forgot that one.
> >
> > On Thu, Dec 04, 2014 at 12:36:43PM +0100, Stefano Sabatini wrote:
[...]
> >> From 65455601f502dd148bcd140f8d70eef104b1bdbe Mon Sep 17 00:00:00 2001
> >> From: Stefano Sabatini <stefasab at gmail.com>
> >> Date: Thu, 4 Dec 2014 12:34:30 +0100
> >> Subject: [PATCH] lavfi/blend: add difference128 mode
> >>
> >> ---
> >>  libavfilter/vf_blend.c | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
> >> index 3c1572c..e73ea35 100644
> >> --- a/libavfilter/vf_blend.c
> >> +++ b/libavfilter/vf_blend.c
> >> @@ -41,6 +41,7 @@ enum BlendMode {
> >>      BLEND_BURN,
> >>      BLEND_DARKEN,
> >>      BLEND_DIFFERENCE,
> >> +    BLEND_DIFFERENCE128,
> >>      BLEND_DIVIDE,
> >>      BLEND_DODGE,
> >>      BLEND_EXCLUSION,
> >> @@ -114,6 +115,7 @@ static const AVOption blend_options[] = {
> >>      { "burn",       "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_BURN},       0,
> >> 0, FLAGS, "mode" },
> >>      { "darken",     "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DARKEN},     0,
> >> 0, FLAGS, "mode" },
> >>      { "difference", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE}, 0,
> >> 0, FLAGS, "mode" },
> >> +    { "difference128", "", 0, AV_OPT_TYPE_CONST,
> >> {.i64=BLEND_DIFFERENCE128}, 0, 0, FLAGS, "mode" },
> >>      { "divide",     "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE},     0,
> >> 0, FLAGS, "mode" },
> >>      { "dodge",      "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE},      0,
> >> 0, FLAGS, "mode" },
> >>      { "exclusion",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION},  0,
> >> 0, FLAGS, "mode" },
> >> @@ -192,6 +194,7 @@ DEFINE_BLEND(subtract,   FFMAX(0, A - B))
> >>  DEFINE_BLEND(multiply,   MULTIPLY(1, A, B))
> >>  DEFINE_BLEND(negation,   255 - FFABS(255 - A - B))
> >>  DEFINE_BLEND(difference, FFABS(A - B))
> >> +DEFINE_BLEND(difference128, av_clip_uint8(128 + A - B))
> >>  DEFINE_BLEND(screen,     SCREEN(1, A, B))
> >>  DEFINE_BLEND(overlay,    (A < 128) ? MULTIPLY(2, A, B) : SCREEN(2, A,
> >> B))
> >>  DEFINE_BLEND(hardlight,  (B < 128) ? MULTIPLY(2, B, A) : SCREEN(2, B,
> >> A))
> >> @@ -315,6 +318,7 @@ static av_cold int init(AVFilterContext *ctx)
> >>          case BLEND_BURN:       param->blend = blend_burn;       break;
> >>          case BLEND_DARKEN:     param->blend = blend_darken;     break;
> >>          case BLEND_DIFFERENCE: param->blend = blend_difference; break;
> >> +        case BLEND_DIFFERENCE128: param->blend = blend_difference128;
> >> break;
> >>          case BLEND_DIVIDE:     param->blend = blend_divide;     break;
> >>          case BLEND_DODGE:      param->blend = blend_dodge;      break;
> >>          case BLEND_EXCLUSION:  param->blend = blend_exclusion;  break;
> >
> > I'm not a maintainer of blend but it looks OK (assuming previous comments
> > are honored).
> 
> The new difference mode is useful, thanks.

Applied, thanks.
-- 
FFmpeg = Fantastic and Fast Mortal Perennial Explosive Gangster


More information about the ffmpeg-devel mailing list