From 171868e25a231ff06864e9f37400680148af10b4 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 28 May 2011 22:00:26 +0200 Subject: lavfi: add negate filter This filter is a simple wrapper around the LUT filter. Signed-off-by: Anton Khirnov --- libavfilter/vf_lut.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libavfilter/vf_lut.c') diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index d7fab5e17d..7f3e913945 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -69,6 +69,7 @@ typedef struct { int is_rgb, is_yuv; int rgba_map[4]; int step; + int negate_alpha; /* only used by negate */ } LutContext; #define Y 0 @@ -369,3 +370,25 @@ DEFINE_LUT_FILTER(lutyuv, "Compute and apply a lookup table to the YUV input vid #if CONFIG_LUTRGB_FILTER DEFINE_LUT_FILTER(lutrgb, "Compute and apply a lookup table to the RGB input video.", init); #endif + +#if CONFIG_NEGATE_FILTER + +static int negate_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + LutContext *lut = ctx->priv; + char lut_params[64]; + + if (args) + sscanf(args, "%d", &lut->negate_alpha); + + av_log(ctx, AV_LOG_DEBUG, "negate_alpha:%d\n", lut->negate_alpha); + + snprintf(lut_params, sizeof(lut_params), "c0=negval:c1=negval:c2=negval:a=%s", + lut->negate_alpha ? "negval" : "val"); + + return init(ctx, lut_params, opaque); +} + +DEFINE_LUT_FILTER(negate, "Negate input video.", negate_init); + +#endif -- cgit v1.2.3