From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 550D849543 for ; Wed, 13 Mar 2024 23:48:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 74C0D68CFE3; Thu, 14 Mar 2024 01:48:02 +0200 (EET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04olkn2061.outbound.protection.outlook.com [40.92.74.61]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A992168C7F8 for ; Thu, 14 Mar 2024 01:47:56 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UUvyulV+XRytNU8tUzdoczr31yDV2jwRUEVRu8xD6+rIuiIfE2RTRUxgpSLU7F2RFM7DWR6lvhjT89G3SPVPC45AMK2n0jBZ0DGwSH1q7brdRu4948MLIpADo7STavJM6o2Vb4isCYQi2+VE/uka5K0eGh1MO4kBj4XDoRUFGupDUAoV07YL7iTPi+sf5vA7VVdCp8nLbinl9fmoY5f4e+8wfwudB7DhOzdFhmhNUJtpAoK/UhDWJkfm9dJfUXkidLjGRAjKPHkMcw6fV/xwkSoWZZJVeYk69ZtEzN1xvQmJQyu2PGhgQHNZLhQuacjHGcdiiXrr3mB93n7bWVEQOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qD19+RKKp2KzPherBqU3VjSd6CS881WKv2caP63oviA=; b=QGu4LTrXFVR8LEoY70H2PKTqTjjlrQ1UwS57Klm2aQwCvfG+3+MjxD+RE73I7ONtDM8SOTqN6HZ8glV5IQC71QuHOFRO6FAJc7YMSyqLA/vMOpCyd7ia0zMSm3y0Wa+aGcGvNZuJtHL9RwQ7+k8E9x20D9diQ/me0YLJQsJqYB4E1fdFENLvLTR7hT+oOg4KbY+MWn1DaiFDNlremxOrgs/QA/OfNNeyH4wIroVE0oB7+/9q8CSiJkD6OeMtDv2EJFGebe3EKsXx6glDhClgDCw1qtnsKaI37BxF8eV3AvT5wGhWn+vcSGW+LxU9pT5xrZODn0J4yltL0j1Mwd7Ltg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qD19+RKKp2KzPherBqU3VjSd6CS881WKv2caP63oviA=; b=Q0aTMrRgRH6OABg1nUHMWWSxAfORiwOQ6HmxPl+TYF/R/2H6Ygvc3zxNFCRcov9ROIEVVXRitISSURs49UAMMaS7yYmxRL80qnLe1MtQDpAnmLbB0u1jiiuH6BTEk/+TlhUaQTpJgsYPxxB064P/16uQa3vOHU5pbkfvNmrKn7fKzggr5svB0nDMVNXH4BlkzH+wZ9LviBGlIi/0oL2GNc7nhPPIS8UpL8s79aReHWSUJYsx78Dy3TFKeMAbfV4EIPtujrXhfbAdfgjpvYIEkdg3wMCKk+kqlQV8KBWjgBFnXjpQRK1zT2dMj9HMKlVmmVJIFNAl+DmmM1hXwe8fVg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PAXP250MB0574.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:286::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26; Wed, 13 Mar 2024 23:47:54 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.035; Wed, 13 Mar 2024 23:47:54 +0000 Message-ID: Date: Thu, 14 Mar 2024 00:47:52 +0100 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20240313122425.92457-1-ffmpeg@haasn.xyz> <20240313122425.92457-2-ffmpeg@haasn.xyz> From: Andreas Rheinhardt In-Reply-To: <20240313122425.92457-2-ffmpeg@haasn.xyz> X-TMN: [SJw+Z+mfbRudH0sqzYKkrM0e5fJUL6f0] X-ClientProxiedBy: ZR2P278CA0003.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::6) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <372340c0-a32b-4fe4-bc4e-d3e0a23c3e44@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PAXP250MB0574:EE_ X-MS-Office365-Filtering-Correlation-Id: d65934e0-cf36-4cbf-2315-08dc43b80086 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 94SjMhsU7sWGO8JMI6W9e+W4Byvr6pME93sVop5JFenqEwOTVs5O7yyxnax4pTAqXlTq5W9pnIxtMVIBGCMHtYxH2+VZKEHtKMjWw/hwqToUPR2Q7FXlWPQJSSr1/l8ixl69HCxuALT9ImfOn0kJE+NUEl1GN/VREcRJ+H9yKVv+6D3G+u2FKYxv25ad9nzrjK5HhxJIF604h867OyFLoQ6qBWos1mhP3rDeJtG/mm/iV4tin5A8aCv371Ly+/3IRYPe8yOUZY6W3dzJKrNDlZ5FHwMtMXj25uAh3/xQY87dBSZLud8+8a/7T8aScx3+L0WGOKFtJBEJhYQ0LzQfu94peWsuKt53NOynCoBR4xAMXAlrOR8rq3deIcYMu8ouRVO7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x4RnAwTFl4YzU2N2tveE5PUDk4K0JkcGJwTVR0bG5m?= =?utf-8?B?Y1ZpdXU5VFpESXRYanJadHZnbUc3NmtabGFCUGI3dDQyREk2WFowV2RXd0Fy?= =?utf-8?B?T2E1cGp2WWVxdzdkN3BMb2kvc2lZQ2lDVFowR0xhZzNvNHk5cEpGcmxDZm9U?= =?utf-8?B?UmhTV2pSd0kzSjlxcktwRmxoL0kySVBUUkVBZ1o0QmRzVENHWlIxZ3c1S3FW?= =?utf-8?B?Ymh4akpJMy80Sm1GV2xlcE1aQjdraDJ0eWFKQnZaVXEzU1d6RnFRMVdBPT0=?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d65934e0-cf36-4cbf-2315-08dc43b80086 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2024 23:47:54.3431 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP250MB0574 Subject: Re: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_scale2ref: switch to FFFrameSync X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Niklas Haas: > From: Niklas Haas > > This filter's existing design has a number of issues: > > - There is no guarantee whatsoever about the order in which frames are > pushed onto the main and ref link, due to this being entirely > dependent on the order in which downstream filters decide to request > frames from their various inputs. As such, there is absolutely no > synchronization for ref streams with dynamically changing resolutions > (see e.g. fate/h264/reinit-*). > > - For some (likely historical) reason, this filter outputs its ref > stream as a second ref output, which is in principle completely > unnecessary (complex filter graph users can just duplicate the input > pin), but in practice only required to allow this filter to > "eventually" see changes to the ref stream (see first point). In > particular, this means that if the user uses the "wrong" pin, this > filter may break completely. > > - The default filter activation function is fundamentally incapable of > handling filters with multiple inputs cleanly, because doing so > requires both knowledge of how these inputs should be internally > ordered, but also how to handle EOF conditions on either input (or > downstream). Both of these are best left to the filter specific > options. (See #10795 for the consequences of using the default > activate with multiple inputs). > > Switching this filter to framesync fixes all three points: > > - ff_framesync_activate() correctly handles multiple inputs and EOF > conditions (and is configurable with the framesync-specific options) > - framesync only supports a single output, so we can (indeed must) drop > the redundant ref output stream > > Update documentation, changelog and tests to correspond to the new usage > pattern. > > Fixes: https://trac.ffmpeg.org/ticket/10795 > --- > Changelog | 2 + > doc/filters.texi | 10 +- > libavfilter/vf_scale.c | 130 ++++++++++++----------- > tests/filtergraphs/scale2ref_keep_aspect | 3 +- > 4 files changed, 76 insertions(+), 69 deletions(-) > > diff --git a/Changelog b/Changelog > index 069b8274489..bacda2524ea 100644 > --- a/Changelog > +++ b/Changelog > @@ -32,6 +32,8 @@ version : > - DVD-Video demuxer, powered by libdvdnav and libdvdread > - ffprobe -show_stream_groups option > - ffprobe (with -export_side_data film_grain) now prints film grain metadata > +- scale2ref now only has a single output stream, and supports the framesync > + options > > > version 6.1: > diff --git a/doc/filters.texi b/doc/filters.texi > index e0436a5755c..07e8136adb3 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -21555,9 +21555,9 @@ Deprecated, do not use. > Scale (resize) the input video, based on a reference video. > > See the scale filter for available options, scale2ref supports the same but > -uses the reference video instead of the main input as basis. scale2ref also > -supports the following additional constants for the @option{w} and > -@option{h} options: > +uses the reference video instead of the main input as basis. This filter also > +supports the @ref{framesync} options. In addition, scale2ref also supports the > +following additional constants for the @option{w} and @option{h} options: > > @table @var > @item main_w > @@ -21600,13 +21600,13 @@ Only available with @code{eval=frame}. > @item > Scale a subtitle stream (b) to match the main video (a) in size before overlaying > @example > -'scale2ref[b][a];[a][b]overlay' > +'[b][a]scale2ref[sub];[a][sub]overlay' > @end example > > @item > Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio. > @example > -[logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out] > +[logo-in][video]scale2ref=w=oh*mdar:h=ih/10[logo-out] > @end example > @end itemize > > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c > index fc3b5a91e60..d4173b63097 100644 > --- a/libavfilter/vf_scale.c > +++ b/libavfilter/vf_scale.c > @@ -29,6 +29,7 @@ > > #include "avfilter.h" > #include "formats.h" > +#include "framesync.h" > #include "internal.h" > #include "scale_eval.h" > #include "video.h" > @@ -114,6 +115,7 @@ typedef struct ScaleContext { > struct SwsContext *isws[2]; ///< software scaler context for interlaced material > // context used for forwarding options to sws > struct SwsContext *sws_opts; > + FFFrameSync fs; ///< for scale2ref > > /** > * New dimensions. Special values are: > @@ -288,6 +290,9 @@ static av_cold int preinit(AVFilterContext *ctx) > if (ret < 0) > return ret; > > + if (ctx->filter == &ff_vf_scale2ref) > + ff_framesync_preinit(&scale->fs); > + > return 0; > } > > @@ -303,6 +308,8 @@ static const int sws_colorspaces[] = { > -1 > }; > > +static int do_scale2ref(FFFrameSync *fs); > + > static av_cold int init(AVFilterContext *ctx) > { > ScaleContext *scale = ctx->priv; > @@ -380,6 +387,7 @@ static av_cold int init(AVFilterContext *ctx) > if (!threads) > av_opt_set_int(scale->sws_opts, "threads", ff_filter_get_nb_threads(ctx), 0); > > + scale->fs.on_event = do_scale2ref; > return 0; > } > > @@ -389,6 +397,7 @@ static av_cold void uninit(AVFilterContext *ctx) > av_expr_free(scale->w_pexpr); > av_expr_free(scale->h_pexpr); > scale->w_pexpr = scale->h_pexpr = NULL; > + ff_framesync_uninit(&scale->fs); > sws_freeContext(scale->sws_opts); > sws_freeContext(scale->sws); > sws_freeContext(scale->isws[0]); > @@ -678,35 +687,16 @@ static int config_props(AVFilterLink *outlink) > flags_val); > av_freep(&flags_val); > > - return 0; > - > -fail: > - return ret; > -} > - > -static int config_props_ref(AVFilterLink *outlink) > -{ > - AVFilterLink *inlink = outlink->src->inputs[1]; > - > - outlink->w = inlink->w; > - outlink->h = inlink->h; > - outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; > - outlink->time_base = inlink->time_base; > - outlink->frame_rate = inlink->frame_rate; > - outlink->colorspace = inlink->colorspace; > - outlink->color_range = inlink->color_range; > + if (ctx->filter != &ff_vf_scale2ref) > + return 0; > > - return 0; > -} > + if ((ret = ff_framesync_init_dualinput(&scale->fs, ctx)) < 0) > + return ret; > > -static int request_frame(AVFilterLink *outlink) > -{ > - return ff_request_frame(outlink->src->inputs[0]); > -} > + return ff_framesync_configure(&scale->fs); > > -static int request_frame_ref(AVFilterLink *outlink) > -{ > - return ff_request_frame(outlink->src->inputs[1]); > +fail: > + return ret; > } > > static void frame_offset(AVFrame *frame, int dir, int is_pal) > @@ -909,43 +899,49 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) > return ret; > } > > -static int filter_frame_ref(AVFilterLink *link, AVFrame *in) > +static int do_scale2ref(FFFrameSync *fs) > { > - ScaleContext *scale = link->dst->priv; > - AVFilterLink *outlink = link->dst->outputs[1]; > - int frame_changed; > + AVFilterContext *ctx = fs->parent; > + ScaleContext *scale = ctx->priv; > + AVFilterLink *reflink = ctx->inputs[1]; > + AVFilterLink *outlink = ctx->outputs[0]; > + AVFrame *main, *ref, *out; > + int ret; > > - frame_changed = in->width != link->w || > - in->height != link->h || > - in->format != link->format || > - in->sample_aspect_ratio.den != link->sample_aspect_ratio.den || > - in->sample_aspect_ratio.num != link->sample_aspect_ratio.num || > - in->colorspace != link->colorspace || > - in->color_range != link->color_range; > + ret = ff_framesync_dualinput_get(fs, &main, &ref); > + if (ret < 0) > + return ret; > > - if (frame_changed) { > - link->format = in->format; > - link->w = in->width; > - link->h = in->height; > - link->sample_aspect_ratio.num = in->sample_aspect_ratio.num; > - link->sample_aspect_ratio.den = in->sample_aspect_ratio.den; > - link->colorspace = in->colorspace; > - link->color_range = in->color_range; > + if (ref) { > + reflink->format = ref->format; > + reflink->w = ref->width; > + reflink->h = ref->height; > + reflink->sample_aspect_ratio.num = ref->sample_aspect_ratio.num; > + reflink->sample_aspect_ratio.den = ref->sample_aspect_ratio.den; > + reflink->colorspace = ref->colorspace; > + reflink->color_range = ref->color_range; > > - config_props_ref(outlink); > - } > + ret = config_props(outlink); > + if (ret < 0) > + return ret; > > - if (scale->eval_mode == EVAL_MODE_FRAME) { > - scale->var_values[VAR_N] = link->frame_count_out; > - scale->var_values[VAR_T] = TS2T(in->pts, link->time_base); > + if (scale->eval_mode == EVAL_MODE_FRAME) { > + scale->var_values[VAR_N] = reflink->frame_count_out; > + scale->var_values[VAR_T] = TS2T(ref->pts, reflink->time_base); > #if FF_API_FRAME_PKT > FF_DISABLE_DEPRECATION_WARNINGS > - scale->var_values[VAR_POS] = in->pkt_pos == -1 ? NAN : in->pkt_pos; > + scale->var_values[VAR_POS] = ref->pkt_pos == -1 ? NAN : ref->pkt_pos; > FF_ENABLE_DEPRECATION_WARNINGS > #endif > + } > + } > + > + ret = scale_frame(ctx->inputs[0], main, &out); > + if (out) { > + return ff_filter_frame(outlink, out); > } > > - return ff_filter_frame(outlink, in); > + return ret; > } > > static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, > @@ -973,9 +969,25 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar > return ret; > } > > +static int activate(AVFilterContext *ctx) > +{ > + ScaleContext *scale = ctx->priv; > + return ff_framesync_activate(&scale->fs); > +} > + > static const AVClass *child_class_iterate(void **iter) > { > - const AVClass *c = *iter ? NULL : sws_get_class(); > + void *tmp = NULL; > + const AVClass *sws = sws_get_class(); > + const AVClass *fs = ff_framesync_child_class_iterate(tmp); This should be &tmp. It is probably the reason for Michael's segfault. Apart from that: It is easier if you simply used 0..2 for *iter (1== returned sws_get_class, 2 returned ff_framesync_child_class_iterate). > + const AVClass *c; > + if (!*iter) { > + c = sws; > + } else if (*iter == (void*)(uintptr_t)sws) { > + c = fs; > + } else { > + c = NULL; > + } > *iter = (void*)(uintptr_t)c; > return c; > } > @@ -985,6 +997,8 @@ static void *child_next(void *obj, void *prev) > ScaleContext *s = obj; > if (!prev) > return s->sws_opts; > + if (prev == s->sws_opts) > + return &s->fs; > return NULL; > } > > @@ -1082,12 +1096,10 @@ static const AVFilterPad avfilter_vf_scale2ref_inputs[] = { > { > .name = "default", > .type = AVMEDIA_TYPE_VIDEO, > - .filter_frame = filter_frame, > }, > { > .name = "ref", > .type = AVMEDIA_TYPE_VIDEO, > - .filter_frame = filter_frame_ref, > }, > }; > > @@ -1096,13 +1108,6 @@ static const AVFilterPad avfilter_vf_scale2ref_outputs[] = { > .name = "default", > .type = AVMEDIA_TYPE_VIDEO, > .config_props = config_props, > - .request_frame= request_frame, > - }, > - { > - .name = "ref", > - .type = AVMEDIA_TYPE_VIDEO, > - .config_props = config_props_ref, > - .request_frame= request_frame_ref, > }, > }; > > @@ -1117,5 +1122,6 @@ const AVFilter ff_vf_scale2ref = { > FILTER_INPUTS(avfilter_vf_scale2ref_inputs), > FILTER_OUTPUTS(avfilter_vf_scale2ref_outputs), > FILTER_QUERY_FUNC(query_formats), > + .activate = activate, > .process_command = process_command, > }; > diff --git a/tests/filtergraphs/scale2ref_keep_aspect b/tests/filtergraphs/scale2ref_keep_aspect > index f407460ec7c..d63968666a8 100644 > --- a/tests/filtergraphs/scale2ref_keep_aspect > +++ b/tests/filtergraphs/scale2ref_keep_aspect > @@ -1,5 +1,4 @@ > sws_flags=+accurate_rnd+bitexact; > testsrc=size=320x240 [main]; > testsrc=size=640x360 [ref]; > -[main][ref] scale2ref=iw/4:ow/mdar [main][ref]; > -[ref] nullsink > +[main][ref] scale2ref=iw/4:ow/mdar [main] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".