152 #define OFFSET(x) offsetof(SelectContext, x)
153 #define DEFINE_OPTIONS(filt_name, FLAGS) \
154 static const AVOption filt_name##_options[] = { \
155 { "expr", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
156 { "e", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
157 { "outputs", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
158 { "n", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
191 #define INTERLACE_TYPE_P 0
192 #define INTERLACE_TYPE_T 1
193 #define INTERLACE_TYPE_B 2
254 int x,
y, nb_sad = 0;
259 const int p1_linesize = frame->
linesize[0];
260 const int p2_linesize = prev_picref->
linesize[0];
262 for (y = 0; y < frame->
height - 7; y += 8) {
263 for (x = 0; x < frame->
width*3 - 7; x += 8) {
264 sad += select->
sad(p1 + x, p1_linesize, p2 + x, p2_linesize);
267 p1 += 8 * p1_linesize;
268 p2 += 8 * p2_linesize;
271 mafd = nb_sad ? (double)sad / nb_sad : 0;
273 ret = av_clipf(
FFMIN(mafd, diff) / 100., 0, 1);
281 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
282 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
301 switch (inlink->
type) {
323 "n:%f pts:%f t:%f key:%d",
329 switch (inlink->
type) {
346 }
else if (
isnan(res) || res < 0) {
428 #if CONFIG_ASELECT_FILTER
438 if ((ret =
init(ctx)) < 0)
449 static const AVFilterPad avfilter_af_aselect_inputs[] = {
462 .init = aselect_init,
465 .
inputs = avfilter_af_aselect_inputs,
466 .priv_class = &aselect_class,
471 #if CONFIG_SELECT_FILTER
480 if ((ret =
init(ctx)) < 0)
486 static const AVFilterPad avfilter_vf_select_inputs[] = {
503 .priv_class = &select_class,
504 .
inputs = avfilter_vf_select_inputs,