[FFmpeg-devel] [PATCH v2] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink.

Damiano Galassi damiog at gmail.com
Sun Mar 24 15:47:27 EET 2024


On Sun, Mar 24, 2024 at 2:14 PM Niklas Haas <ffmpeg at haasn.xyz> wrote:

> On Sun, 24 Mar 2024 13:49:04 +0100 Damiano Galassi <damiog at 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.

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

Sorry if I'm not clear enough.


More information about the ffmpeg-devel mailing list