* [FFmpeg-devel] [PATCH] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink.
@ 2024-03-22 21:02 Damiano Galassi
2024-03-23 12:11 ` Niklas Haas
0 siblings, 1 reply; 3+ messages in thread
From: Damiano Galassi @ 2024-03-22 21:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Damiano Galassi
There two new fields were never sent down the filter chain, and no filter after the first had colorspace and color_range set, causing breakage in zscale and possible other filters.
---
libavfilter/avfilter.c | 4 ++++
libavfilter/buffersrc.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 831871de90..153fb700d3 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -391,6 +391,10 @@ int ff_filter_config_links(AVFilterContext *filter)
link->w = inlink->w;
if (!link->h)
link->h = inlink->h;
+ if (link->colorspace == AVCOL_SPC_UNSPECIFIED)
+ link->colorspace = inlink->color_range;
+ if (link->color_range == AVCOL_RANGE_UNSPECIFIED)
+ link->color_range = inlink->color_range;
} else if (!link->w || !link->h) {
av_log(link->src, AV_LOG_ERROR,
"Video source filters must set their output link's "
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index ddcd403785..2760097edf 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -499,6 +499,8 @@ static int config_props(AVFilterLink *link)
link->w = c->w;
link->h = c->h;
link->sample_aspect_ratio = c->pixel_aspect;
+ link->colorspace = c->color_space;
+ link->color_range = c->color_range;
if (c->hw_frames_ctx) {
link->hw_frames_ctx = av_buffer_ref(c->hw_frames_ctx);
--
2.39.3 (Apple Git-146)
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink.
2024-03-22 21:02 [FFmpeg-devel] [PATCH] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink Damiano Galassi
@ 2024-03-23 12:11 ` Niklas Haas
2024-03-23 12:29 ` Damiano Galassi
0 siblings, 1 reply; 3+ messages in thread
From: Niklas Haas @ 2024-03-23 12:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Damiano Galassi
On Fri, 22 Mar 2024 22:02:39 +0100 Damiano Galassi <damiog@gmail.com> wrote:
> There two new fields were never sent down the filter chain, and no filter after the first had colorspace and color_range set, causing breakage in zscale and possible other filters.
> ---
> libavfilter/avfilter.c | 4 ++++
> libavfilter/buffersrc.c | 2 ++
> 2 files changed, 6 insertions(+)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 831871de90..153fb700d3 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -391,6 +391,10 @@ int ff_filter_config_links(AVFilterContext *filter)
> link->w = inlink->w;
> if (!link->h)
> link->h = inlink->h;
> + if (link->colorspace == AVCOL_SPC_UNSPECIFIED)
> + link->colorspace = inlink->color_range;
> + if (link->color_range == AVCOL_RANGE_UNSPECIFIED)
> + link->color_range = inlink->color_range;
> } else if (!link->w || !link->h) {
> av_log(link->src, AV_LOG_ERROR,
> "Video source filters must set their output link's "
> diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> index ddcd403785..2760097edf 100644
> --- a/libavfilter/buffersrc.c
> +++ b/libavfilter/buffersrc.c
> @@ -499,6 +499,8 @@ static int config_props(AVFilterLink *link)
> link->w = c->w;
> link->h = c->h;
> link->sample_aspect_ratio = c->pixel_aspect;
> + link->colorspace = c->color_space;
> + link->color_range = c->color_range;
>
> if (c->hw_frames_ctx) {
> link->hw_frames_ctx = av_buffer_ref(c->hw_frames_ctx);
LGTM, good catch!
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink.
2024-03-23 12:11 ` Niklas Haas
@ 2024-03-23 12:29 ` Damiano Galassi
0 siblings, 0 replies; 3+ messages in thread
From: Damiano Galassi @ 2024-03-23 12:29 UTC (permalink / raw)
To: ffmpeg-devel
On Sat, Mar 23, 2024 at 1:11 PM Niklas Haas <ffmpeg@haasn.xyz> wrote:
> On Fri, 22 Mar 2024 22:02:39 +0100 Damiano Galassi <damiog@gmail.com>
> wrote:
> > There two new fields were never sent down the filter chain, and no
> filter after the first had colorspace and color_range set, causing breakage
> in zscale and possible other filters.
> > ---
> > libavfilter/avfilter.c | 4 ++++
> > libavfilter/buffersrc.c | 2 ++
> > 2 files changed, 6 insertions(+)
> >
> > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> > index 831871de90..153fb700d3 100644
> > --- a/libavfilter/avfilter.c
> > +++ b/libavfilter/avfilter.c
> > @@ -391,6 +391,10 @@ int ff_filter_config_links(AVFilterContext *filter)
> > link->w = inlink->w;
> > if (!link->h)
> > link->h = inlink->h;
> > + if (link->colorspace == AVCOL_SPC_UNSPECIFIED)
> > + link->colorspace = inlink->color_range;
> > + if (link->color_range == AVCOL_RANGE_UNSPECIFIED)
> > + link->color_range = inlink->color_range;
> > } else if (!link->w || !link->h) {
> > av_log(link->src, AV_LOG_ERROR,
> > "Video source filters must set their output
> link's "
> > diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
> > index ddcd403785..2760097edf 100644
> > --- a/libavfilter/buffersrc.c
> > +++ b/libavfilter/buffersrc.c
> > @@ -499,6 +499,8 @@ static int config_props(AVFilterLink *link)
> > link->w = c->w;
> > link->h = c->h;
> > link->sample_aspect_ratio = c->pixel_aspect;
> > + link->colorspace = c->color_space;
> > + link->color_range = c->color_range;
> >
> > if (c->hw_frames_ctx) {
> > link->hw_frames_ctx = av_buffer_ref(c->hw_frames_ctx);
>
> LGTM, good catch!
>
Unfortunately it breaks some tests:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240322210239.68833-1-damiog@gmail.com/
I didn't check yet what's going on there.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-23 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 21:02 [FFmpeg-devel] [PATCH] avfilter: propagate colorspace and color_range from buffer filter and between AVFilterLink Damiano Galassi
2024-03-23 12:11 ` Niklas Haas
2024-03-23 12:29 ` Damiano Galassi
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