Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Lynne <dev@lynne.ee>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace_vulkan: fix FPS and PTS calculation
Date: Wed, 21 May 2025 23:39:00 +0900
Message-ID: <e31cf4b0-db39-43a4-8783-087802c6a68b@lynne.ee> (raw)
In-Reply-To: <20250521141236.99974-1-ffmpeg@haasn.xyz>


[-- Attachment #1.1.1.1: Type: text/plain, Size: 2137 bytes --]

LGTM

On 21/05/2025 23:12, Niklas Haas wrote:
> From: Niklas Haas <git@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);
>   }
>   


[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 637 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

      reply	other threads:[~2025-05-21 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 14:12 Niklas Haas
2025-05-21 14:39 ` Lynne [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e31cf4b0-db39-43a4-8783-087802c6a68b@lynne.ee \
    --to=dev@lynne.ee \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git