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: Sun, 24 Mar 2024 18:53:31 +0100
Message-ID: <20240324185331.GB5677@haasn.xyz> (raw)
In-Reply-To: <CAK4TZ3LmhvgZgPnc-x8MmU9Dqp_6ZSHOw8qsqFFUAZnZNhPD5g@mail.gmail.com>

On Sun, 24 Mar 2024 14:47:27 +0100 Damiano Galassi <damiog@gmail.com> wrote:
> On Sun, Mar 24, 2024 at 2:14 PM Niklas Haas <ffmpeg@haasn.xyz> wrote:
> 
> > On Sun, 24 Mar 2024 13:49:04 +0100 Damiano Galassi <damiog@gmail.com>
> > wrote:
> > > AVFilterLink colorspace and color_range are first set in
> > > avfiltergraph.c pick_format(),
> > > so in ff_filter_config_links() they will never be AVCOL_SPC_NONE or
> > > AVCOL_SPC_NONE.
> >
> > Wait, now I'm confused what this patch even accomplishes then. If it's
> > already set, what else is there to do?
> 
> 
> Because pick_format() doesn't set the right values, it doesn't know anything
> outside the AVFilterLink it's working on.
> So it sets a value that works for the link incfg and outcfg, but it doesn't
> propagate
> values between different links, and 99% of the times sets an unspecified
> value.

But wait - aren't all filter's lists set to the same reference? Isn't that the
point of the design? If they share the same format list, they will all
inherit the correct setting (via pick_format). Except for filters like
vf_scale which deliberately use separate format lists, since they can
perform conversion. But even in this case,
swap_color_spaces_on_filters() should ensure that both lists are set to
the same value IFF they support the same color spaces.

Upon further inspection, it actually appears like the propagation you
propose in this patch is only needed for things which *aren't* subject
to format negotiation, which is why width, height and sample aspect
ratio are propagated here, but things like format or sample rates are not.

So this patch as written should not be applied, I think.

> What I meant was that your patch didn't make any difference from the
> existing behavior
> because even if it sets the default AVFilterLink values to AVCOL_SPC_NONE
> and AVCOL_SPC_NONE,
> when it's the time to call ff_filter_config_links(), those two values have
> already been reset
> to a default unspecified value, so you still get a wrongly configure graph
> with something like:
> 
> Buffer
>     Link:  AVCOL_SPC_BT709 AVCOL_RANGE_MPEG
> Scale
>     Link: AVCOL_SPC_UNSPECIFIED AVCOL_RANGE_UNSPECIFIED
> Whateverfilter
>     Link: AVCOL_SPC_UNSPECIFIED AVCOL_RANGE_UNSPECIFIED
> Buffersink
> 
> instead of
> 
> Buffer
>     Link: AVCOL_SPC_BT709 AVCOL_RANGE_MPEG
> Scale
>     Link: AVCOL_SPC_BT709 AVCOL_RANGE_MPEG
> Whateverfilter
>     Link: AVCOL_SPC_BT709 AVCOL_RANGE_MPEG
> Buffersink

Perhaps you can describe this scenario more thoroughly? What filters are
you using downstream of 'scale' here, and does it advertise BT709 as
supported?

> 
> Sorry if I'm not clear enough.
> _______________________________________________
> 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".
_______________________________________________
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-24 17:53 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 [this message]
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

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=20240324185331.GB5677@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