[FFmpeg-devel] Again pre-multiplied alpha
Nicolas George
george at nsup.org
Thu Jul 24 17:59:24 EEST 2025
Niklas Haas (HE12025-07-24):
> That is no worse than the status quo, so I fail to see how this patch is
> a regression in this regard.
Until now, premultiplied frames were an anecdotal experimental feature
with barely any documentation: only people who knew what they were doing
were supposed to use it, and if they corrupted their output by getting
it wrong the blame was on them.
With this patch series, it becomes an officially supported feature,
people who know nothing will start using it. That requires more
guardrails against accidental corruption of the output.
> That aside, there is also not anything preventing you from doing the same
> for images with a different chroma sample location, or different HDR metadata,
> or different sample aspect ratios, or any of the other oodles of properties
> (including arbitrarily extensible frame side data) that are not currently
> participating in libavfilter format negotiation.
The fact that we have played it fast and loose in the past should not be
considered a justification to play it fast and loose now.
> In a perfect world, we would have automatic format negotiation for every
> AVFrame property; but as it stands, the libavfilter code is too obnoxious,
> brittle and inflexible to permit such while remaining sane. While redesigning
> libavfilter to make it more extensible would certainly be a useful exercise
I know how to redesign the format negotiation to make it modular. But
the current code requires test coverage.
> (perhaps a good STF 2025 candidate?),
Increasing test coverage, certainly yes.
Reworking the negotiation in depth to make it modular, almost certainly
no: too hard.
> I think that rather exceeds the scope
> of this patchset.
Right now, I an not demanding negotiation, I am just requiring
protection:
if (frame->is_premultiplied && !out->supports_premultiplied) {
av_log(ctx, AV_LOG_ERROR, "Your data is about to be
corrupted because it comes as premultiplied alpha.");
return AVERROR_PATCHWELCOME;
}
Regards,
--
Nicolas George
More information about the ffmpeg-devel
mailing list