Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas <ffmpeg@haasn.xyz>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink.
Date: Mon, 25 Mar 2024 16:07:10 +0100
Message-ID: <20240325160710.GB63939@haasn.xyz> (raw)
In-Reply-To: <20240325160223.GB26889@haasn.xyz>

On Mon, 25 Mar 2024 16:02:23 +0100 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> On Mon, 25 Mar 2024 15:36:26 +0100 Damiano Galassi <damiog@gmail.com> wrote:
> > On Mon, Mar 25, 2024 at 2:40 PM Niklas Haas <ffmpeg@haasn.xyz> wrote:
> > 
> > > > ffmpeg -i in.mp4 -vf
> > > > "scale='width=1920:height=1080',zscale='width=1920:height=1080'" out.mp4
> > > > ffmpeg -i in.jpg -vf "zscale='width=1920:height=1080'" out.jpg
> > > >
> > > > it doesn't need a specific mp4 or jpg file.
> > >
> > > I cannot reproduce any error with your first command line.
> > 
> > 
> >  here's a sample file, and the output I get:
> > 
> > https://subler.org/downloads/test.mp4
> > https://gist.github.com/galad87/a6ddc3318cf20cd2f1ac7d053e1a0786
> 
> Okay, I see the problem. Basically, swap_color_spaces() doesn't re-run
> after pick_formats() settles a filter's format. So swap_color_spaces()
> never actually sets zscale's preferred output format, because at that
> point there are still multiple options for swscale's output format.
> 
> This patch appears to help, but I'm honestly not sure what exactly the
> difference is between this REDUCE_FORMATS() and swap_color_spaces(), or
> actually, for what case the latter even exists.

I *think* that the former is intended for picking an exact match,
whereas the latter is intended for picking the *best* remaining match
(where bestness can be meaningfully measured by some score)

So based on this, given that csp/range is only concerned with exact
matches, after the suggest patch we can just delete swap_color_spaces()
and swap_color_ranges(). Good riddance, too.

> 
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index bb5399c55e8..3b8f7464889 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -794,6 +794,10 @@ static int reduce_formats_on_filter(AVFilterContext *filter)
>                     nb_formats, ff_add_format);
>      REDUCE_FORMATS(int,      AVFilterFormats,        samplerates,     formats,
>                     nb_formats, ff_add_format);
> +    REDUCE_FORMATS(int,      AVFilterFormats,        color_spaces,    formats,
> +                   nb_formats, ff_add_format);
> +    REDUCE_FORMATS(int,      AVFilterFormats,        color_ranges,    formats,
> +                   nb_formats, ff_add_format);
>  
>      /* reduce channel layouts */
>      for (i = 0; i < filter->nb_inputs; i++) {
_______________________________________________
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:[~2024-03-25 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24  9:26 Damiano Galassi
2024-03-24 12:23 ` Niklas Haas
2024-03-24 12:25   ` Niklas Haas
2024-03-24 12:49   ` Damiano Galassi
2024-03-24 13:14     ` Niklas Haas
2024-03-24 13:47       ` Damiano Galassi
2024-03-24 17:53         ` Niklas Haas
2024-03-24 19:03           ` Damiano Galassi
2024-03-25 13:25             ` Niklas Haas
2024-03-25 13:40             ` Niklas Haas
2024-03-25 14:36               ` Damiano Galassi
2024-03-25 15:02                 ` Niklas Haas
2024-03-25 15:07                   ` Niklas Haas [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=20240325160710.GB63939@haasn.xyz \
    --to=ffmpeg@haasn.xyz \
    --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