Commit 97b5b9db authored by Paul B Mahol's avatar Paul B Mahol

avfilter: split negate filter from lut filter

Using luts for negating is suboptimal.

FATE test changes because filter no longer clips values into limited color range.
parent 069f7831
......@@ -15551,6 +15551,19 @@ Negate (invert) the input video.
It accepts the following option:
@table @option
@item components
Set components to negate.
Available values for components are:
@table @samp
@item y
@item u
@item v
@item a
@item r
@item g
@item b
@end table
@item negate_alpha
With value 1, it negates the alpha component, if present. Default value is 0.
......
......@@ -350,7 +350,7 @@ OBJS-$(CONFIG_MIX_FILTER) += vf_mix.o framesync.o
OBJS-$(CONFIG_MONOCHROME_FILTER) += vf_monochrome.o
OBJS-$(CONFIG_MORPHO_FILTER) += vf_morpho.o
OBJS-$(CONFIG_MPDECIMATE_FILTER) += vf_mpdecimate.o
OBJS-$(CONFIG_NEGATE_FILTER) += vf_lut.o
OBJS-$(CONFIG_NEGATE_FILTER) += vf_negate.o
OBJS-$(CONFIG_NLMEANS_FILTER) += vf_nlmeans.o
OBJS-$(CONFIG_NLMEANS_OPENCL_FILTER) += vf_nlmeans_opencl.o opencl.o opencl/nlmeans.o
OBJS-$(CONFIG_NNEDI_FILTER) += vf_nnedi.o
......
......@@ -69,7 +69,6 @@ typedef struct LutContext {
int is_planar;
int is_16bit;
int step;
int negate_alpha; /* only used by negate */
} LutContext;
#define Y 0
......@@ -642,30 +641,3 @@ static av_cold int lutrgb_init(AVFilterContext *ctx)
DEFINE_LUT_FILTER(lutrgb, "Compute and apply a lookup table to the RGB input video.",
lut);
#endif
#if CONFIG_NEGATE_FILTER
static const AVOption negate_options[] = {
{ "negate_alpha", NULL, OFFSET(negate_alpha), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ NULL }
};
AVFILTER_DEFINE_CLASS(negate);
static av_cold int negate_init(AVFilterContext *ctx)
{
LutContext *s = ctx->priv;
for (int i = 0; i < 4; i++) {
s->comp_expr_str[i] = av_strdup((i == 3 && !s->negate_alpha) ?
"val" : "negval");
if (!s->comp_expr_str[i])
return AVERROR(ENOMEM);
}
return 0;
}
DEFINE_LUT_FILTER(negate, "Negate input video.", negate);
#endif
This diff is collapsed.
......@@ -3,53 +3,53 @@
#codec_id 0: rawvideo
#dimensions 0: 352x288
#sar 0: 0/1
0, 0, 0, 1, 152064, 0xef20e1ec
0, 1, 1, 1, 152064, 0x899606ec
0, 2, 2, 1, 152064, 0xaea175d2
0, 3, 3, 1, 152064, 0x5201eb55
0, 4, 4, 1, 152064, 0xf02bb525
0, 5, 5, 1, 152064, 0x99fdc305
0, 6, 6, 1, 152064, 0x3a8fefe7
0, 7, 7, 1, 152064, 0x005edfbf
0, 8, 8, 1, 152064, 0xe37aea50
0, 9, 9, 1, 152064, 0xa5ad32f9
0, 10, 10, 1, 152064, 0xb1e52485
0, 11, 11, 1, 152064, 0x55b06e56
0, 12, 12, 1, 152064, 0xdfb7be97
0, 13, 13, 1, 152064, 0x191bca13
0, 14, 14, 1, 152064, 0xa554dd3c
0, 15, 15, 1, 152064, 0x36075b77
0, 16, 16, 1, 152064, 0xbf6b1cbd
0, 17, 17, 1, 152064, 0xf33432b6
0, 18, 18, 1, 152064, 0x5d7100c3
0, 19, 19, 1, 152064, 0x376f8f0c
0, 20, 20, 1, 152064, 0x07ca75fa
0, 21, 21, 1, 152064, 0xe3984704
0, 22, 22, 1, 152064, 0xa8fb4e4c
0, 23, 23, 1, 152064, 0xe8e102d8
0, 24, 24, 1, 152064, 0xcc6771c9
0, 25, 25, 1, 152064, 0xf646d238
0, 26, 26, 1, 152064, 0xa52cd41e
0, 27, 27, 1, 152064, 0x536d92c2
0, 28, 28, 1, 152064, 0x7058c6a1
0, 29, 29, 1, 152064, 0xcc6c05d0
0, 30, 30, 1, 152064, 0x1fc2ffb8
0, 31, 31, 1, 152064, 0x041ea59c
0, 32, 32, 1, 152064, 0xfc006e07
0, 33, 33, 1, 152064, 0x0246efe1
0, 34, 34, 1, 152064, 0x079428e5
0, 35, 35, 1, 152064, 0x64d9d773
0, 36, 36, 1, 152064, 0x914d3454
0, 37, 37, 1, 152064, 0xef69686e
0, 38, 38, 1, 152064, 0x3c91129f
0, 39, 39, 1, 152064, 0x2a611ca7
0, 40, 40, 1, 152064, 0xaf56124f
0, 41, 41, 1, 152064, 0xce48cd45
0, 42, 42, 1, 152064, 0x75feac29
0, 43, 43, 1, 152064, 0xfd2b4b5b
0, 44, 44, 1, 152064, 0x8d2f675c
0, 45, 45, 1, 152064, 0x1573ed3b
0, 46, 46, 1, 152064, 0xb0fc17ca
0, 47, 47, 1, 152064, 0x53e5a654
0, 48, 48, 1, 152064, 0xe0cbb786
0, 49, 49, 1, 152064, 0xcaa092fe
0, 0, 0, 1, 152064, 0xdb0946b2
0, 1, 1, 1, 152064, 0x950c6b50
0, 2, 2, 1, 152064, 0x42e3da48
0, 3, 3, 1, 152064, 0xb63d4ff1
0, 4, 4, 1, 152064, 0x92dd1a4f
0, 5, 5, 1, 152064, 0xf2fc27bb
0, 6, 6, 1, 152064, 0xfea2547e
0, 7, 7, 1, 152064, 0x860b44f5
0, 8, 8, 1, 152064, 0xc1a5507b
0, 9, 9, 1, 152064, 0x4f89978c
0, 10, 10, 1, 152064, 0xde8c8941
0, 11, 11, 1, 152064, 0xafcbd3bd
0, 12, 12, 1, 152064, 0x19af2340
0, 13, 13, 1, 152064, 0xbbd42e7e
0, 14, 14, 1, 152064, 0x8e1c42c4
0, 15, 15, 1, 152064, 0x37a4c19c
0, 16, 16, 1, 152064, 0x528a8289
0, 17, 17, 1, 152064, 0x2f6397d9
0, 18, 18, 1, 152064, 0xee5265d5
0, 19, 19, 1, 152064, 0xed64f493
0, 20, 20, 1, 152064, 0xe436db22
0, 21, 21, 1, 152064, 0x42f9ac8f
0, 22, 22, 1, 152064, 0x9c63b348
0, 23, 23, 1, 152064, 0xb19967b2
0, 24, 24, 1, 152064, 0x12b7d6bc
0, 25, 25, 1, 152064, 0x4b69376b
0, 26, 26, 1, 152064, 0x9ce939ec
0, 27, 27, 1, 152064, 0x0940f80b
0, 28, 28, 1, 152064, 0x69ee2c4c
0, 29, 29, 1, 152064, 0x72fd6b93
0, 30, 30, 1, 152064, 0xd12365d7
0, 31, 31, 1, 152064, 0xfe1c0b83
0, 32, 32, 1, 152064, 0x095ad405
0, 33, 33, 1, 152064, 0xfe825671
0, 34, 34, 1, 152064, 0x60d68d29
0, 35, 35, 1, 152064, 0xe6243ba6
0, 36, 36, 1, 152064, 0x942998f6
0, 37, 37, 1, 152064, 0x3bb3cea9
0, 38, 38, 1, 152064, 0xd5b97755
0, 39, 39, 1, 152064, 0x584d81c4
0, 40, 40, 1, 152064, 0x0e4d777c
0, 41, 41, 1, 152064, 0x0bdc3299
0, 42, 42, 1, 152064, 0xbff210f8
0, 43, 43, 1, 152064, 0x8964afb5
0, 44, 44, 1, 152064, 0xe361cc30
0, 45, 45, 1, 152064, 0x7f0c522e
0, 46, 46, 1, 152064, 0xd6d17ca2
0, 47, 47, 1, 152064, 0x72380adf
0, 48, 48, 1, 152064, 0x25391c1e
0, 49, 49, 1, 152064, 0x9506f7a8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment