Merge commit '51def31dbe5b6e857536de8fa428f263d64f3ae5'
* commit '51def31dbe5b6e857536de8fa428f263d64f3ae5': vf_boxblur: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vf_boxblur.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
eb6d58d23c
@ -2008,6 +2008,19 @@ pairs, separated by ":". If the key of the first options is omitted,
|
|||||||
the arguments are interpreted according to the syntax
|
the arguments are interpreted according to the syntax
|
||||||
@option{luma_radius}:@option{luma_power}:@option{chroma_radius}:@option{chroma_power}:@option{alpha_radius}:@option{alpha_power}.
|
@option{luma_radius}:@option{luma_power}:@option{chroma_radius}:@option{chroma_power}:@option{alpha_radius}:@option{alpha_power}.
|
||||||
|
|
||||||
|
This filter accepts the following options:
|
||||||
|
|
||||||
|
@table @option
|
||||||
|
|
||||||
|
@item luma_radius
|
||||||
|
@item luma_power
|
||||||
|
@item chroma_radius
|
||||||
|
@item chroma_power
|
||||||
|
@item alpha_radius
|
||||||
|
@item alpha_power
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
A description of the accepted options follows.
|
A description of the accepted options follows.
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
@ -2059,6 +2072,7 @@ A value of 0 will disable the effect.
|
|||||||
Apply a boxblur filter with luma, chroma, and alpha radius
|
Apply a boxblur filter with luma, chroma, and alpha radius
|
||||||
set to 2:
|
set to 2:
|
||||||
@example
|
@example
|
||||||
|
boxblur=luma_radius=2:luma_power=1
|
||||||
boxblur=2:1
|
boxblur=2:1
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@ -2071,7 +2085,7 @@ boxblur=2:1:cr=0:ar=0
|
|||||||
@item
|
@item
|
||||||
Set luma and chroma radius to a fraction of the video dimension:
|
Set luma and chroma radius to a fraction of the video dimension:
|
||||||
@example
|
@example
|
||||||
boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
|
boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
|
||||||
@end example
|
@end example
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
@ -658,6 +658,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
|
|||||||
int anton_options =
|
int anton_options =
|
||||||
!strcmp(filter->filter->name, "aformat") ||
|
!strcmp(filter->filter->name, "aformat") ||
|
||||||
!strcmp(filter->filter->name, "blackframe") ||
|
!strcmp(filter->filter->name, "blackframe") ||
|
||||||
|
!strcmp(filter->filter->name, "boxblur" ) ||
|
||||||
!strcmp(filter->filter->name, "format") ||
|
!strcmp(filter->filter->name, "format") ||
|
||||||
!strcmp(filter->filter->name, "noformat") ||
|
!strcmp(filter->filter->name, "noformat") ||
|
||||||
!strcmp(filter->filter->name, "resample")
|
!strcmp(filter->filter->name, "resample")
|
||||||
|
@ -73,30 +73,6 @@ typedef struct {
|
|||||||
uint8_t *temp[2]; ///< temporary buffer used in blur_power()
|
uint8_t *temp[2]; ///< temporary buffer used in blur_power()
|
||||||
} BoxBlurContext;
|
} BoxBlurContext;
|
||||||
|
|
||||||
#define OFFSET(x) offsetof(BoxBlurContext, x)
|
|
||||||
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
|
|
||||||
|
|
||||||
static const AVOption boxblur_options[] = {
|
|
||||||
{ "luma_radius", "set luma radius", OFFSET(luma_param.radius_expr), AV_OPT_TYPE_STRING, {.str="2"}, .flags = FLAGS },
|
|
||||||
{ "lr", "set luma radius", OFFSET(luma_param.radius_expr), AV_OPT_TYPE_STRING, {.str="2"}, .flags = FLAGS },
|
|
||||||
{ "luma_power", "set luma power", OFFSET(luma_param.power), AV_OPT_TYPE_INT, {.i64=2}, 0, INT_MAX, .flags = FLAGS },
|
|
||||||
{ "lp", "set luma power", OFFSET(luma_param.power), AV_OPT_TYPE_INT, {.i64=2}, 0, INT_MAX, .flags = FLAGS },
|
|
||||||
|
|
||||||
{ "chroma_radius", "set chroma radius", OFFSET(chroma_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
|
||||||
{ "cr", "set chroma radius", OFFSET(chroma_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
|
||||||
{ "chroma_power", "set chroma power", OFFSET(chroma_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
|
||||||
{ "cp", "set chroma power", OFFSET(chroma_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
|
||||||
|
|
||||||
{ "alpha_radius", "set alpha radius", OFFSET(alpha_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
|
||||||
{ "ar", "set alpha radius", OFFSET(alpha_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
|
||||||
{ "alpha_power", "set alpha power", OFFSET(alpha_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
|
||||||
{ "ap", "set alpha power", OFFSET(alpha_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
|
||||||
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
AVFILTER_DEFINE_CLASS(boxblur);
|
|
||||||
|
|
||||||
#define Y 0
|
#define Y 0
|
||||||
#define U 1
|
#define U 1
|
||||||
#define V 2
|
#define V 2
|
||||||
@ -106,6 +82,11 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
|
|||||||
{
|
{
|
||||||
BoxBlurContext *boxblur = ctx->priv;
|
BoxBlurContext *boxblur = ctx->priv;
|
||||||
|
|
||||||
|
if (!boxblur->luma_param.radius_expr) {
|
||||||
|
av_log(ctx, AV_LOG_ERROR, "Luma radius expression is not set.\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
/* fill missing params */
|
/* fill missing params */
|
||||||
if (!boxblur->chroma_param.radius_expr) {
|
if (!boxblur->chroma_param.radius_expr) {
|
||||||
boxblur->chroma_param.radius_expr = av_strdup(boxblur->luma_param.radius_expr);
|
boxblur->chroma_param.radius_expr = av_strdup(boxblur->luma_param.radius_expr);
|
||||||
@ -349,6 +330,30 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define OFFSET(x) offsetof(BoxBlurContext, x)
|
||||||
|
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
|
||||||
|
|
||||||
|
static const AVOption boxblur_options[] = {
|
||||||
|
{ "luma_radius", "Radius of the luma blurring box", OFFSET(luma_param.radius_expr), AV_OPT_TYPE_STRING, {.str="2"}, .flags = FLAGS },
|
||||||
|
{ "lr", "Radius of the luma blurring box", OFFSET(luma_param.radius_expr), AV_OPT_TYPE_STRING, {.str="2"}, .flags = FLAGS },
|
||||||
|
{ "luma_power", "How many times should the boxblur be applied to luma", OFFSET(luma_param.power), AV_OPT_TYPE_INT, {.i64=2}, 0, INT_MAX, .flags = FLAGS },
|
||||||
|
{ "lp", "How many times should the boxblur be applied to luma", OFFSET(luma_param.power), AV_OPT_TYPE_INT, {.i64=2}, 0, INT_MAX, .flags = FLAGS },
|
||||||
|
|
||||||
|
{ "chroma_radius", "Radius of the chroma blurring box", OFFSET(chroma_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
||||||
|
{ "cr", "Radius of the chroma blurring box", OFFSET(chroma_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
||||||
|
{ "chroma_power", "How many times should the boxblur be applied to chroma", OFFSET(chroma_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
||||||
|
{ "cp", "How many times should the boxblur be applied to chroma", OFFSET(chroma_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
||||||
|
|
||||||
|
{ "alpha_radius", "Radius of the alpha blurring box", OFFSET(alpha_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
||||||
|
{ "ar", "Radius of the alpha blurring box", OFFSET(alpha_param.radius_expr), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
|
||||||
|
{ "alpha_power", "How many times should the boxblur be applied to alpha", OFFSET(alpha_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
||||||
|
{ "ap", "How many times should the boxblur be applied to alpha", OFFSET(alpha_param.power), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
|
||||||
|
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
AVFILTER_DEFINE_CLASS(boxblur);
|
||||||
|
|
||||||
static const AVFilterPad avfilter_vf_boxblur_inputs[] = {
|
static const AVFilterPad avfilter_vf_boxblur_inputs[] = {
|
||||||
{
|
{
|
||||||
.name = "default",
|
.name = "default",
|
||||||
@ -367,24 +372,15 @@ static const AVFilterPad avfilter_vf_boxblur_outputs[] = {
|
|||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const shorthand[] = {
|
|
||||||
"luma_radius", "luma_power",
|
|
||||||
"chroma_radius", "chroma_power",
|
|
||||||
"alpha_radius", "alpha_power",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
AVFilter avfilter_vf_boxblur = {
|
AVFilter avfilter_vf_boxblur = {
|
||||||
.name = "boxblur",
|
.name = "boxblur",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Blur the input."),
|
.description = NULL_IF_CONFIG_SMALL("Blur the input."),
|
||||||
.priv_size = sizeof(BoxBlurContext),
|
.priv_size = sizeof(BoxBlurContext),
|
||||||
|
.priv_class = &boxblur_class,
|
||||||
.init = init,
|
.init = init,
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
.query_formats = query_formats,
|
.query_formats = query_formats,
|
||||||
|
|
||||||
.inputs = avfilter_vf_boxblur_inputs,
|
.inputs = avfilter_vf_boxblur_inputs,
|
||||||
.outputs = avfilter_vf_boxblur_outputs,
|
.outputs = avfilter_vf_boxblur_outputs,
|
||||||
|
|
||||||
.priv_class = &boxblur_class,
|
|
||||||
.shorthand = shorthand,
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user