Also add and use the '|' separator instead of ':' since it's
incompatible with the new option system...
... | ... |
@@ -4605,6 +4605,13 @@ Subfilters must be separated by '/' and can be disabled by prepending a '-'. |
4605 | 4605 |
Each subfilter and some options have a short and a long name that can be used |
4606 | 4606 |
interchangeably, i.e. dr/dering are the same. |
4607 | 4607 |
|
4608 |
+The filters accept the following options: |
|
4609 |
+ |
|
4610 |
+@table @option |
|
4611 |
+@item subfilters |
|
4612 |
+Set postprocessing subfilters string. |
|
4613 |
+@end table |
|
4614 |
+ |
|
4608 | 4615 |
All subfilters share common options to determine their scope: |
4609 | 4616 |
|
4610 | 4617 |
@table @option |
... | ... |
@@ -4621,12 +4628,12 @@ Do luminance filtering only (no chrominance). |
4621 | 4621 |
Do chrominance filtering only (no luminance). |
4622 | 4622 |
@end table |
4623 | 4623 |
|
4624 |
-These options can be appended after the subfilter name, separated by a ':'. |
|
4624 |
+These options can be appended after the subfilter name, separated by a '|'. |
|
4625 | 4625 |
|
4626 | 4626 |
Available subfilters are: |
4627 | 4627 |
|
4628 | 4628 |
@table @option |
4629 |
-@item hb/hdeblock[:difference[:flatness]] |
|
4629 |
+@item hb/hdeblock[|difference[|flatness]] |
|
4630 | 4630 |
Horizontal deblocking filter |
4631 | 4631 |
@table @option |
4632 | 4632 |
@item difference |
... | ... |
@@ -4635,7 +4642,7 @@ Difference factor where higher values mean more deblocking (default: @code{32}). |
4635 | 4635 |
Flatness threshold where lower values mean more deblocking (default: @code{39}). |
4636 | 4636 |
@end table |
4637 | 4637 |
|
4638 |
-@item vb/vdeblock[:difference[:flatness]] |
|
4638 |
+@item vb/vdeblock[|difference[|flatness]] |
|
4639 | 4639 |
Vertical deblocking filter |
4640 | 4640 |
@table @option |
4641 | 4641 |
@item difference |
... | ... |
@@ -4644,7 +4651,7 @@ Difference factor where higher values mean more deblocking (default: @code{32}). |
4644 | 4644 |
Flatness threshold where lower values mean more deblocking (default: @code{39}). |
4645 | 4645 |
@end table |
4646 | 4646 |
|
4647 |
-@item ha/hadeblock[:difference[:flatness]] |
|
4647 |
+@item ha/hadeblock[|difference[|flatness]] |
|
4648 | 4648 |
Accurate horizontal deblocking filter |
4649 | 4649 |
@table @option |
4650 | 4650 |
@item difference |
... | ... |
@@ -4653,7 +4660,7 @@ Difference factor where higher values mean more deblocking (default: @code{32}). |
4653 | 4653 |
Flatness threshold where lower values mean more deblocking (default: @code{39}). |
4654 | 4654 |
@end table |
4655 | 4655 |
|
4656 |
-@item va/vadeblock[:difference[:flatness]] |
|
4656 |
+@item va/vadeblock[|difference[|flatness]] |
|
4657 | 4657 |
Accurate vertical deblocking filter |
4658 | 4658 |
@table @option |
4659 | 4659 |
@item difference |
... | ... |
@@ -4677,7 +4684,7 @@ Experimental vertical deblocking filter |
4677 | 4677 |
@item dr/dering |
4678 | 4678 |
Deringing filter |
4679 | 4679 |
|
4680 |
-@item tn/tmpnoise[:threshold1[:threshold2[:threshold3]]], temporal noise reducer |
|
4680 |
+@item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer |
|
4681 | 4681 |
@table @option |
4682 | 4682 |
@item threshold1 |
4683 | 4683 |
larger -> stronger filtering |
... | ... |
@@ -4717,7 +4724,7 @@ second line with a @code{(-1 4 2 4 -1)} filter. |
4717 | 4717 |
Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given |
4718 | 4718 |
block by filtering all lines with a @code{(-1 2 6 2 -1)} filter. |
4719 | 4719 |
|
4720 |
-@item fq/forceQuant[:quantizer] |
|
4720 |
+@item fq/forceQuant[|quantizer] |
|
4721 | 4721 |
Overrides the quantizer table from the input with the constant quantizer you |
4722 | 4722 |
specify. |
4723 | 4723 |
@table @option |
... | ... |
@@ -4726,13 +4733,13 @@ Quantizer to use |
4726 | 4726 |
@end table |
4727 | 4727 |
|
4728 | 4728 |
@item de/default |
4729 |
-Default pp filter combination (@code{hb:a,vb:a,dr:a}) |
|
4729 |
+Default pp filter combination (@code{hb|a,vb|a,dr|a}) |
|
4730 | 4730 |
|
4731 | 4731 |
@item fa/fast |
4732 |
-Fast pp filter combination (@code{h1:a,v1:a,dr:a}) |
|
4732 |
+Fast pp filter combination (@code{h1|a,v1|a,dr|a}) |
|
4733 | 4733 |
|
4734 | 4734 |
@item ac |
4735 |
-High quality pp filter combination (@code{ha:a:128:7,va:a,dr:a}) |
|
4735 |
+High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a}) |
|
4736 | 4736 |
@end table |
4737 | 4737 |
|
4738 | 4738 |
@subsection Examples |
... | ... |
@@ -4754,14 +4761,14 @@ pp=de/-al |
4754 | 4754 |
@item |
4755 | 4755 |
Apply default filters and temporal denoiser: |
4756 | 4756 |
@example |
4757 |
-pp=default/tmpnoise:1:2:3 |
|
4757 |
+pp=default/tmpnoise|1|2|3 |
|
4758 | 4758 |
@end example |
4759 | 4759 |
|
4760 | 4760 |
@item |
4761 | 4761 |
Apply deblocking on luminance only, and switch vertical deblocking on or off |
4762 | 4762 |
automatically depending on available CPU time: |
4763 | 4763 |
@example |
4764 |
-pp=hb:y/vb:a |
|
4764 |
+pp=hb|y/vb|a |
|
4765 | 4765 |
@end example |
4766 | 4766 |
@end itemize |
4767 | 4767 |
|
... | ... |
@@ -686,6 +686,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque |
686 | 686 |
!strcmp(filter->filter->name, "format") || |
687 | 687 |
!strcmp(filter->filter->name, "noformat") || |
688 | 688 |
!strcmp(filter->filter->name, "perms") || |
689 |
+ !strcmp(filter->filter->name, "pp" ) || |
|
689 | 690 |
!strcmp(filter->filter->name, "aperms") || |
690 | 691 |
!strcmp(filter->filter->name, "resample") || |
691 | 692 |
!strcmp(filter->filter->name, "showspectrum") || |
... | ... |
@@ -31,21 +31,29 @@ |
31 | 31 |
#include "libpostproc/postprocess.h" |
32 | 32 |
|
33 | 33 |
typedef struct { |
34 |
+ const AVClass *class; |
|
35 |
+ char *subfilters; |
|
34 | 36 |
int mode_id; |
35 | 37 |
pp_mode *modes[PP_QUALITY_MAX + 1]; |
36 | 38 |
void *pp_ctx; |
37 | 39 |
} PPFilterContext; |
38 | 40 |
|
41 |
+#define OFFSET(x) offsetof(PPFilterContext, x) |
|
42 |
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM |
|
43 |
+static const AVOption pp_options[] = { |
|
44 |
+ { "subfilters", "set postprocess subfilters", OFFSET(subfilters), AV_OPT_TYPE_STRING, {.str="de"}, .flags = FLAGS }, |
|
45 |
+ { NULL } |
|
46 |
+}; |
|
47 |
+ |
|
48 |
+AVFILTER_DEFINE_CLASS(pp); |
|
49 |
+ |
|
39 | 50 |
static av_cold int pp_init(AVFilterContext *ctx, const char *args) |
40 | 51 |
{ |
41 | 52 |
int i; |
42 | 53 |
PPFilterContext *pp = ctx->priv; |
43 | 54 |
|
44 |
- if (!args || !*args) |
|
45 |
- args = "de"; |
|
46 |
- |
|
47 | 55 |
for (i = 0; i <= PP_QUALITY_MAX; i++) { |
48 |
- pp->modes[i] = pp_get_mode_by_name_and_quality(args, i); |
|
56 |
+ pp->modes[i] = pp_get_mode_by_name_and_quality(pp->subfilters, i); |
|
49 | 57 |
if (!pp->modes[i]) |
50 | 58 |
return AVERROR_EXTERNAL; |
51 | 59 |
} |
... | ... |
@@ -171,4 +179,6 @@ AVFilter avfilter_vf_pp = { |
171 | 171 |
.inputs = pp_inputs, |
172 | 172 |
.outputs = pp_outputs, |
173 | 173 |
.process_command = pp_process_command, |
174 |
+ .priv_class = &pp_class, |
|
175 |
+ |
|
174 | 176 |
}; |
... | ... |
@@ -666,7 +666,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality) |
666 | 666 |
char temp[GET_MODE_BUFFER_SIZE]; |
667 | 667 |
char *p= temp; |
668 | 668 |
static const char filterDelimiters[] = ",/"; |
669 |
- static const char optionDelimiters[] = ":"; |
|
669 |
+ static const char optionDelimiters[] = ":|"; |
|
670 | 670 |
struct PPMode *ppMode; |
671 | 671 |
char *filterToken; |
672 | 672 |
|
... | ... |
@@ -29,7 +29,7 @@ |
29 | 29 |
#include "libavutil/avutil.h" |
30 | 30 |
|
31 | 31 |
#define LIBPOSTPROC_VERSION_MAJOR 52 |
32 |
-#define LIBPOSTPROC_VERSION_MINOR 2 |
|
32 |
+#define LIBPOSTPROC_VERSION_MINOR 3 |
|
33 | 33 |
#define LIBPOSTPROC_VERSION_MICRO 100 |
34 | 34 |
|
35 | 35 |
#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ |
... | ... |
@@ -52,8 +52,8 @@ do_lavfi "overlay_yuv420" "split[m],scale=88:72,pad=96:80:4:4[o2];[m]fifo[o1 |
52 | 52 |
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" |
53 | 53 |
do_lavfi "pad" "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2" |
54 | 54 |
do_lavfi "pp" "pp=be/hb/vb/tn/l5/al" |
55 |
-do_lavfi "pp2" "pp=be/fq:16/h1/v1/lb" |
|
56 |
-do_lavfi "pp3" "pp=be/fq:8/ha:128:7/va/li" |
|
55 |
+do_lavfi "pp2" "pp=be/fq|16/h1/v1/lb" |
|
56 |
+do_lavfi "pp3" "pp=be/fq|8/ha|128|7/va/li" |
|
57 | 57 |
do_lavfi "pp4" "pp=be/ci" |
58 | 58 |
do_lavfi "pp5" "pp=md" |
59 | 59 |
do_lavfi "pp6" "pp=be/fd" |