Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nicolas George <george@nsup.org>
To: tc@ffmpeg.org
Cc: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] The patch series about premultiplied alpha
Date: Sat, 2 Aug 2025 20:03:23 +0200
Message-ID: <aI5S6y-XCiSYHrVp@phare.normalesup.org> (raw)
In-Reply-To: <aI4sMdKYl6QBQsbn@phare.normalesup.org>

Nicolas George (HE12025-08-02):
> - The patch series lacks transverse user documentation.
> 
> - The patch series increases the risk of data corruption due to user
>   negligence and should include at least some guardrails against that.

Here is the situation before this patch series:

- All alpha is supposed to be straight by default.

- A few niche decoders (EXR, JPEG XL) would silently output
  premultiplied alpha.

- A few niche encoders (the same) would silently assume their input is
  premultiplied alpha.

- There is a pair of filters premultiply / unpremultiply.

- The overlay filter supports premultiplied alpha if enabled with an
  undocumented option.

- There is no protection at all: if a command connects input with one
  kind of alpha with out expecting the other kind at any point, it will
  produce invalid output without so much as a warning.

- There is barely any documentation at all. The filters are documented
  for what they do and that is all.

(IIRC, I would have fought the inclusion of the filters, but with Paul
one must choose one's battles.)

This patch series makes support for premultiplied alpha official.
Ideally, official support should include transparent automatic
conversion, but that would require too much work. But I think that
before inclusion it must fix the two worst problems:

- lack of documentation;

- risk of creating invalid output without any warning,

considering that the work to achieve it is a moderate fraction of the
work already invested in the patch series.

Documentation is easy: just write a few paragraphs to explain what
premultiplied alpha is, where it likely to occur (what did motivate the
writing of this series?) and how to deal with it (links to the
conversion filters).

Protection against creating invalid output, now. As I mentioned above,
full negotiation and automatic conversion, which would be ideal, is too
much work and therefore too much to ask. Niklas agree on that.

On the other hand, protection, i.e. emitting an error and letting the
user deal with it, is not much work:

- add a flag to filters that support premultiplied input;

- add a check for that flag in the framework.

In total, maybe two lines in a header, four lines in framework code and
one line per filter that will not damage the output. Similar work has
already be done for encoders.

Such limited work would make the feature much less dangerous for users,
it should be done before the feature reaches the public.

Regards,

-- 
  Nicolas George
_______________________________________________
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:[~2025-08-02 18:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-02 15:18 Nicolas George
2025-08-02 18:03 ` Nicolas George [this message]
2025-08-03 10:42   ` Niklas Haas
2025-08-03 10:50     ` 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=aI5S6y-XCiSYHrVp@phare.normalesup.org \
    --to=george@nsup.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=tc@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