mirror of
https://github.com/librempeg/librempeg
synced 2024-11-22 18:49:58 +00:00
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...
This commit is contained in:
parent
f8eabab04d
commit
8da1fff85a
@ -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
|
||||
|
||||
|
@ -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") ||
|
||||
|
@ -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,
|
||||
|
||||
};
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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, \
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user