[FFmpeg-devel] [PATCH] avfilter/vf_interlace_vulkan: fix FPS and PTS calculation
Lynne
dev at lynne.ee
Wed May 21 17:39:00 EEST 2025
LGTM
On 21/05/2025 23:12, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
>
> ol->frame_rate is 0/0, so we need to calcalute the correct value based on
> the il->frame_rate instead. Also adjust the time base, PTS and frame_duration
> values accordingly. (Logic taken from vf_tinterlace.c)
> ---
> libavfilter/vf_interlace_vulkan.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_interlace_vulkan.c b/libavfilter/vf_interlace_vulkan.c
> index b5cd321fef..7afb30c2d7 100644
> --- a/libavfilter/vf_interlace_vulkan.c
> +++ b/libavfilter/vf_interlace_vulkan.c
> @@ -189,7 +189,9 @@ static int interlace_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
> AVFrame *out = NULL, *input_top, *input_bot;
> AVFilterContext *ctx = link->dst;
> InterlaceVulkanContext *s = ctx->priv;
> + const AVFilterLink *inlink = ctx->inputs[0];
> AVFilterLink *outlink = ctx->outputs[0];
> + FilterLink *l = ff_filter_link(outlink);
>
> if (!s->initialized)
> RET(init_filter(ctx));
> @@ -226,6 +228,9 @@ static int interlace_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
> if (s->mode == MODE_TFF)
> out->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
>
> + out->pts = av_rescale_q(out->pts, inlink->time_base, outlink->time_base);
> + out->duration = av_rescale_q(1, av_inv_q(l->frame_rate), outlink->time_base);
> +
> av_frame_free(&s->cur);
> av_frame_free(&in);
>
> @@ -260,9 +265,12 @@ static void interlace_vulkan_uninit(AVFilterContext *avctx)
>
> static int config_out_props(AVFilterLink *outlink)
> {
> + AVFilterLink *inlink = outlink->src->inputs[0];
> + const FilterLink *il = ff_filter_link(inlink);
> FilterLink *ol = ff_filter_link(outlink);
>
> - ol->frame_rate = av_mul_q(ol->frame_rate, av_make_q(1, 2));
> + ol->frame_rate = av_mul_q(il->frame_rate, av_make_q(1, 2));
> + outlink->time_base = av_mul_q(inlink->time_base, av_make_q(2, 1));
> return ff_vk_filter_config_output(outlink);
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250521/763b9664/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250521/763b9664/attachment.sig>
More information about the ffmpeg-devel
mailing list