aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-04-10 22:43:25 +0200
committerClément Bœsch <ubitux@gmail.com>2013-04-10 23:16:03 +0200
commit8da1fff85a90b2fad1310e629ed2056d6c43f50e (patch)
tree5d2b159b96daf0d88a513be459362c78e86f5993
parentf8eabab04d1b429bc0332c06a46ae3c344a4cb15 (diff)
downloadffmpeg-8da1fff85a90b2fad1310e629ed2056d6c43f50e.tar.gz
lavfi/pp: switch to an AVOptions-based system.
Also add and use the '|' separator instead of ':' since it's incompatible with the new option system...
-rw-r--r--doc/filters.texi31
-rw-r--r--libavfilter/avfilter.c1
-rw-r--r--libavfilter/vf_pp.c18
-rw-r--r--libpostproc/postprocess.c2
-rw-r--r--libpostproc/version.h2
-rwxr-xr-xtests/lavfi-regression.sh4
6 files changed, 38 insertions, 20 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 00a804a4b1..ed192189d3 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4605,6 +4605,13 @@ Subfilters must be separated by '/' and can be disabled by prepending a '-'.
Each subfilter and some options have a short and a long name that can be used
interchangeably, i.e. dr/dering are the same.
+The filters accept the following options:
+
+@table @option
+@item subfilters
+Set postprocessing subfilters string.
+@end table
+
All subfilters share common options to determine their scope:
@table @option
@@ -4621,12 +4628,12 @@ Do luminance filtering only (no chrominance).
Do chrominance filtering only (no luminance).
@end table
-These options can be appended after the subfilter name, separated by a ':'.
+These options can be appended after the subfilter name, separated by a '|'.
Available subfilters are:
@table @option
-@item hb/hdeblock[:difference[:flatness]]
+@item hb/hdeblock[|difference[|flatness]]
Horizontal deblocking filter
@table @option
@item difference
@@ -4635,7 +4642,7 @@ Difference factor where higher values mean more deblocking (default: @code{32}).
Flatness threshold where lower values mean more deblocking (default: @code{39}).
@end table
-@item vb/vdeblock[:difference[:flatness]]
+@item vb/vdeblock[|difference[|flatness]]
Vertical deblocking filter
@table @option
@item difference
@@ -4644,7 +4651,7 @@ Difference factor where higher values mean more deblocking (default: @code{32}).
Flatness threshold where lower values mean more deblocking (default: @code{39}).
@end table
-@item ha/hadeblock[:difference[:flatness]]
+@item ha/hadeblock[|difference[|flatness]]
Accurate horizontal deblocking filter
@table @option
@item difference
@@ -4653,7 +4660,7 @@ Difference factor where higher values mean more deblocking (default: @code{32}).
Flatness threshold where lower values mean more deblocking (default: @code{39}).
@end table
-@item va/vadeblock[:difference[:flatness]]
+@item va/vadeblock[|difference[|flatness]]
Accurate vertical deblocking filter
@table @option
@item difference
@@ -4677,7 +4684,7 @@ Experimental vertical deblocking filter
@item dr/dering
Deringing filter
-@item tn/tmpnoise[:threshold1[:threshold2[:threshold3]]], temporal noise reducer
+@item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
@table @option
@item threshold1
larger -> stronger filtering
@@ -4717,7 +4724,7 @@ second line with a @code{(-1 4 2 4 -1)} filter.
Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
-@item fq/forceQuant[:quantizer]
+@item fq/forceQuant[|quantizer]
Overrides the quantizer table from the input with the constant quantizer you
specify.
@table @option
@@ -4726,13 +4733,13 @@ Quantizer to use
@end table
@item de/default
-Default pp filter combination (@code{hb:a,vb:a,dr:a})
+Default pp filter combination (@code{hb|a,vb|a,dr|a})
@item fa/fast
-Fast pp filter combination (@code{h1:a,v1:a,dr:a})
+Fast pp filter combination (@code{h1|a,v1|a,dr|a})
@item ac
-High quality pp filter combination (@code{ha:a:128:7,va:a,dr:a})
+High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
@end table
@subsection Examples
@@ -4754,14 +4761,14 @@ pp=de/-al
@item
Apply default filters and temporal denoiser:
@example
-pp=default/tmpnoise:1:2:3
+pp=default/tmpnoise|1|2|3
@end example
@item
Apply deblocking on luminance only, and switch vertical deblocking on or off
automatically depending on available CPU time:
@example
-pp=hb:y/vb:a
+pp=hb|y/vb|a
@end example
@end itemize
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index cd47f47d39..13e9ac9098 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -686,6 +686,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
!strcmp(filter->filter->name, "format") ||
!strcmp(filter->filter->name, "noformat") ||
!strcmp(filter->filter->name, "perms") ||
+ !strcmp(filter->filter->name, "pp" ) ||
!strcmp(filter->filter->name, "aperms") ||
!strcmp(filter->filter->name, "resample") ||
!strcmp(filter->filter->name, "showspectrum") ||
diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c
index b7f35d3628..7dfb448790 100644
--- a/libavfilter/vf_pp.c
+++ b/libavfilter/vf_pp.c
@@ -31,21 +31,29 @@
#include "libpostproc/postprocess.h"
typedef struct {
+ const AVClass *class;
+ char *subfilters;
int mode_id;
pp_mode *modes[PP_QUALITY_MAX + 1];
void *pp_ctx;
} PPFilterContext;
+#define OFFSET(x) offsetof(PPFilterContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption pp_options[] = {
+ { "subfilters", "set postprocess subfilters", OFFSET(subfilters), AV_OPT_TYPE_STRING, {.str="de"}, .flags = FLAGS },
+ { NULL }
+};
+
+AVFILTER_DEFINE_CLASS(pp);
+
static av_cold int pp_init(AVFilterContext *ctx, const char *args)
{
int i;
PPFilterContext *pp = ctx->priv;
- if (!args || !*args)
- args = "de";
-
for (i = 0; i <= PP_QUALITY_MAX; i++) {
- pp->modes[i] = pp_get_mode_by_name_and_quality(args, i);
+ pp->modes[i] = pp_get_mode_by_name_and_quality(pp->subfilters, i);
if (!pp->modes[i])
return AVERROR_EXTERNAL;
}
@@ -171,4 +179,6 @@ AVFilter avfilter_vf_pp = {
.inputs = pp_inputs,
.outputs = pp_outputs,
.process_command = pp_process_command,
+ .priv_class = &pp_class,
+
};
diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index facfd2cdd9..b34943f983 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -666,7 +666,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
char temp[GET_MODE_BUFFER_SIZE];
char *p= temp;
static const char filterDelimiters[] = ",/";
- static const char optionDelimiters[] = ":";
+ static const char optionDelimiters[] = ":|";
struct PPMode *ppMode;
char *filterToken;
diff --git a/libpostproc/version.h b/libpostproc/version.h
index d0d3d431f8..111db44e01 100644
--- a/libpostproc/version.h
+++ b/libpostproc/version.h
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBPOSTPROC_VERSION_MAJOR 52
-#define LIBPOSTPROC_VERSION_MINOR 2
+#define LIBPOSTPROC_VERSION_MINOR 3
#define LIBPOSTPROC_VERSION_MICRO 100
#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
index bb023e4567..9076e4fbda 100755
--- a/tests/lavfi-regression.sh
+++ b/tests/lavfi-regression.sh
@@ -52,8 +52,8 @@ do_lavfi "overlay_yuv420" "split[m],scale=88:72,pad=96:80:4:4[o2];[m]fifo[o1
do_lavfi "overlay_yuv444" "split[m],scale=88:72,pad=96:80:4:4[o2];[m]fifo[o1],[o1][o2]overlay=240:16:format=yuv444"
do_lavfi "pad" "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2"
do_lavfi "pp" "pp=be/hb/vb/tn/l5/al"
-do_lavfi "pp2" "pp=be/fq:16/h1/v1/lb"
-do_lavfi "pp3" "pp=be/fq:8/ha:128:7/va/li"
+do_lavfi "pp2" "pp=be/fq|16/h1/v1/lb"
+do_lavfi "pp3" "pp=be/fq|8/ha|128|7/va/li"
do_lavfi "pp4" "pp=be/ci"
do_lavfi "pp5" "pp=md"
do_lavfi "pp6" "pp=be/fd"