avfilter/vf_scale: require straight alpha for alpha blending

Fortunately, we only care if this flag is set - otherwise, this filter is
alpha mode agnostic (since it is purely scaling, etc).

That said, there is an argument to be made that we should prefer premul
alpha when scaling, because scaling in straight alpha will leak garbage
pixels; but I think that would be a too backwards-incompatible change to
be worth thinking about at this time.
This commit is contained in:
Niklas Haas
2025-08-14 18:32:23 +02:00
parent 446a25b70f
commit c7adeb75ac
+6
View File
@@ -520,6 +520,12 @@ static int query_formats(const AVFilterContext *ctx,
if ((ret = ff_formats_ref(formats, &cfg_out[0]->color_ranges)) < 0)
return ret;
if (scale->sws->alpha_blend) {
if ((ret = ff_formats_ref(ff_make_formats_list_singleton(AVALPHA_MODE_STRAIGHT),
&cfg_in[0]->alpha_modes)) < 0)
return ret;
}
return 0;
}