Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-29 00:00:26 +0400
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-06-19 21:06:55 +0400
commit15f03725ced37e3b99e76f63f52cb92e10f134e2 (patch)
treec3615129590315c08798b160cff04e6fe19bfddd /libavfilter
parentdd2793c880ea72c9aacda8245596694d9b4f378c (diff)
lavfi: add negate filter
This filter is a simple wrapper around the LUT filter.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/Makefile1
-rw-r--r--libavfilter/allfilters.c1
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/vf_lut.c23
4 files changed, 26 insertions, 1 deletions
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 8f8abe729e..c594573798 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -42,6 +42,7 @@ OBJS-$(CONFIG_LUT_FILTER) += vf_lut.o
OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o
OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
OBJS-$(CONFIG_MP_FILTER) += vf_mp.o
+OBJS-$(CONFIG_NEGATE_FILTER) += vf_lut.o
OBJS-$(CONFIG_NOFORMAT_FILTER) += vf_format.o
OBJS-$(CONFIG_NULL_FILTER) += vf_null.o
OBJS-$(CONFIG_OCV_FILTER) += vf_libopencv.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3c4a6e17b4..2983f6bd8c 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -58,6 +58,7 @@ void avfilter_register_all(void)
REGISTER_FILTER (LUTRGB, lutrgb, vf);
REGISTER_FILTER (LUTYUV, lutyuv, vf);
REGISTER_FILTER (MP, mp, vf);
+ REGISTER_FILTER (NEGATE, negate, vf);
REGISTER_FILTER (NOFORMAT, noformat, vf);
REGISTER_FILTER (NULL, null, vf);
REGISTER_FILTER (OCV, ocv, vf);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 6dd5020ecf..bcfc4c6df9 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -26,7 +26,7 @@
#include "libavutil/samplefmt.h"
#define LIBAVFILTER_VERSION_MAJOR 2
-#define LIBAVFILTER_VERSION_MINOR 19
+#define LIBAVFILTER_VERSION_MINOR 20
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 895293d12d..792e274c33 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -67,6 +67,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
@@ -366,3 +367,25 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
DEFINE_LUT_FILTER(lut, "Compute and apply a lookup table to the RGB/YUV input video.", init);
DEFINE_LUT_FILTER(lutyuv, "Compute and apply a lookup table to the YUV input video.", init);
DEFINE_LUT_FILTER(lutrgb, "Compute and apply a lookup table to the RGB input video.", init);
+
+#if CONFIG_NEGATE_FILTER
+
+static int negate_init(AVFilterContext *ctx, const char *args, void *opaque)
+{
+ LutContext *lut = ctx->priv;
+ char lut_params[1024];
+
+ if (args)
+ sscanf(args, "%d", &lut->negate_alpha);
+
+ av_log(ctx, AV_LOG_INFO, "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