158 #define OFFSET(x) offsetof(SelectContext, x)
159 #define DEFINE_OPTIONS(filt_name, FLAGS) \
160 static const AVOption filt_name##_options[] = { \
161 { "expr", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
162 { "e", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
163 { "outputs", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
164 { "n", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
176 var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) {
197 #define INTERLACE_TYPE_P 0
198 #define INTERLACE_TYPE_T 1
199 #define INTERLACE_TYPE_B 2
265 int x,
y, nb_sad = 0;
270 const int linesize = frame->
linesize[0];
272 for (y = 0; y < frame->
height - 8; y += 8) {
273 for (x = 0; x < frame->
width*3 - 8; x += 8) {
274 sad += select->c.sad[1](NULL, p1 + x, p2 + x,
282 mafd = nb_sad ? (double)sad / nb_sad : 0;
283 diff = fabs(mafd - select->prev_mafd);
284 ret = av_clipf(
FFMIN(mafd, diff) / 100., 0, 1);
285 select->prev_mafd = mafd;
293 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
294 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
312 switch (inlink->
type) {
336 "n:%f pts:%f t:%f key:%d",
342 switch (inlink->
type) {
360 }
else if (
isnan(res) || res < 0) {
448 #if CONFIG_ASELECT_FILTER
458 if ((ret =
init(ctx)) < 0)
469 static const AVFilterPad avfilter_af_aselect_inputs[] = {
482 .init = aselect_init,
485 .
inputs = avfilter_af_aselect_inputs,
486 .priv_class = &aselect_class,
491 #if CONFIG_SELECT_FILTER
501 if ((ret =
init(ctx)) < 0)
512 static const AVFilterPad avfilter_vf_select_inputs[] = {
529 .priv_class = &select_class,
530 .
inputs = avfilter_vf_select_inputs,