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...
pull/21/head
Clément Bœsch 12 years ago
parent f8eabab04d
commit 8da1fff85a
  1. 31
      doc/filters.texi
  2. 1
      libavfilter/avfilter.c
  3. 18
      libavfilter/vf_pp.c
  4. 2
      libpostproc/postprocess.c
  5. 2
      libpostproc/version.h
  6. 4
      tests/lavfi-regression.sh

@ -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 Each subfilter and some options have a short and a long name that can be used
interchangeably, i.e. dr/dering are the same. 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: All subfilters share common options to determine their scope:
@table @option @table @option
@ -4621,12 +4628,12 @@ Do luminance filtering only (no chrominance).
Do chrominance filtering only (no luminance). Do chrominance filtering only (no luminance).
@end table @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: Available subfilters are:
@table @option @table @option
@item hb/hdeblock[:difference[:flatness]] @item hb/hdeblock[|difference[|flatness]]
Horizontal deblocking filter Horizontal deblocking filter
@table @option @table @option
@item difference @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}). Flatness threshold where lower values mean more deblocking (default: @code{39}).
@end table @end table
@item vb/vdeblock[:difference[:flatness]] @item vb/vdeblock[|difference[|flatness]]
Vertical deblocking filter Vertical deblocking filter
@table @option @table @option
@item difference @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}). Flatness threshold where lower values mean more deblocking (default: @code{39}).
@end table @end table
@item ha/hadeblock[:difference[:flatness]] @item ha/hadeblock[|difference[|flatness]]
Accurate horizontal deblocking filter Accurate horizontal deblocking filter
@table @option @table @option
@item difference @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}). Flatness threshold where lower values mean more deblocking (default: @code{39}).
@end table @end table
@item va/vadeblock[:difference[:flatness]] @item va/vadeblock[|difference[|flatness]]
Accurate vertical deblocking filter Accurate vertical deblocking filter
@table @option @table @option
@item difference @item difference
@ -4677,7 +4684,7 @@ Experimental vertical deblocking filter
@item dr/dering @item dr/dering
Deringing filter Deringing filter
@item tn/tmpnoise[:threshold1[:threshold2[:threshold3]]], temporal noise reducer @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
@table @option @table @option
@item threshold1 @item threshold1
larger -> stronger filtering 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 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
block by filtering all lines with a @code{(-1 2 6 2 -1)} filter. 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 Overrides the quantizer table from the input with the constant quantizer you
specify. specify.
@table @option @table @option
@ -4726,13 +4733,13 @@ Quantizer to use
@end table @end table
@item de/default @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 @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 @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 @end table
@subsection Examples @subsection Examples
@ -4754,14 +4761,14 @@ pp=de/-al
@item @item
Apply default filters and temporal denoiser: Apply default filters and temporal denoiser:
@example @example
pp=default/tmpnoise:1:2:3 pp=default/tmpnoise|1|2|3
@end example @end example
@item @item
Apply deblocking on luminance only, and switch vertical deblocking on or off Apply deblocking on luminance only, and switch vertical deblocking on or off
automatically depending on available CPU time: automatically depending on available CPU time:
@example @example
pp=hb:y/vb:a pp=hb|y/vb|a
@end example @end example
@end itemize @end itemize

@ -686,6 +686,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
!strcmp(filter->filter->name, "format") || !strcmp(filter->filter->name, "format") ||
!strcmp(filter->filter->name, "noformat") || !strcmp(filter->filter->name, "noformat") ||
!strcmp(filter->filter->name, "perms") || !strcmp(filter->filter->name, "perms") ||
!strcmp(filter->filter->name, "pp" ) ||
!strcmp(filter->filter->name, "aperms") || !strcmp(filter->filter->name, "aperms") ||
!strcmp(filter->filter->name, "resample") || !strcmp(filter->filter->name, "resample") ||
!strcmp(filter->filter->name, "showspectrum") || !strcmp(filter->filter->name, "showspectrum") ||

@ -31,21 +31,29 @@
#include "libpostproc/postprocess.h" #include "libpostproc/postprocess.h"
typedef struct { typedef struct {
const AVClass *class;
char *subfilters;
int mode_id; int mode_id;
pp_mode *modes[PP_QUALITY_MAX + 1]; pp_mode *modes[PP_QUALITY_MAX + 1];
void *pp_ctx; void *pp_ctx;
} PPFilterContext; } 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) static av_cold int pp_init(AVFilterContext *ctx, const char *args)
{ {
int i; int i;
PPFilterContext *pp = ctx->priv; PPFilterContext *pp = ctx->priv;
if (!args || !*args)
args = "de";
for (i = 0; i <= PP_QUALITY_MAX; i++) { 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]) if (!pp->modes[i])
return AVERROR_EXTERNAL; return AVERROR_EXTERNAL;
} }
@ -171,4 +179,6 @@ AVFilter avfilter_vf_pp = {
.inputs = pp_inputs, .inputs = pp_inputs,
.outputs = pp_outputs, .outputs = pp_outputs,
.process_command = pp_process_command, .process_command = pp_process_command,
.priv_class = &pp_class,
}; };

@ -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 temp[GET_MODE_BUFFER_SIZE];
char *p= temp; char *p= temp;
static const char filterDelimiters[] = ",/"; static const char filterDelimiters[] = ",/";
static const char optionDelimiters[] = ":"; static const char optionDelimiters[] = ":|";
struct PPMode *ppMode; struct PPMode *ppMode;
char *filterToken; char *filterToken;

@ -29,7 +29,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBPOSTPROC_VERSION_MAJOR 52 #define LIBPOSTPROC_VERSION_MAJOR 52
#define LIBPOSTPROC_VERSION_MINOR 2 #define LIBPOSTPROC_VERSION_MINOR 3
#define LIBPOSTPROC_VERSION_MICRO 100 #define LIBPOSTPROC_VERSION_MICRO 100
#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ #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
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 "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 "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 "pp" "pp=be/hb/vb/tn/l5/al"
do_lavfi "pp2" "pp=be/fq:16/h1/v1/lb" do_lavfi "pp2" "pp=be/fq|16/h1/v1/lb"
do_lavfi "pp3" "pp=be/fq:8/ha:128:7/va/li" do_lavfi "pp3" "pp=be/fq|8/ha|128|7/va/li"
do_lavfi "pp4" "pp=be/ci" do_lavfi "pp4" "pp=be/ci"
do_lavfi "pp5" "pp=md" do_lavfi "pp5" "pp=md"
do_lavfi "pp6" "pp=be/fd" do_lavfi "pp6" "pp=be/fd"

Loading…
Cancel
Save