[FFmpeg-devel] [PATCH v2 01/32] avfilter/palettegen: allow a minimum of 2 colors

Tomas Härdin git at haerdin.se
Tue Jan 3 20:59:45 EET 2023


ons 2022-12-28 klockan 22:23 +0100 skrev Clément Bœsch:
> On Wed, Dec 28, 2022 at 10:04:26PM +0100, Tomas Härdin wrote:
> [...]
> > Does this mean all-black with transparent is disallowed?
> 
> Yes a single color with or without an extra transparency slot makes
> no
> sense.
> 
> > Shouldn't it be max_colors + reserve < 2?
> 
> max_colors accounts for the transparent color as well. So if you
> specify
> 256 colors with reserve_transparent (default settings), you'll get
> 255
> color slots and 1 for transparency.
> 
> It also means that if want to go as low as 2 colors in your palette
> you
> can do max_colors=3 with reserve_transparent=1, or max_colors=2 with
> reserve_transparent=0
> 
>   3-1 → 2
>   2-0 → 2
> 
> These are the minimums.

Right, because there's no "0bpp" pixel format with 1bpp alpha.. yet!
Something similar actually exists with GoldSrc .spr files, especially
the indexalpha mode. It is effectively "0bpp" with 8-bit alpha:
https://the303.org/tutorials/gold_sprite_p3.htm

> 
> PS: sorry for the double answer Tomas!

No problem :)

/Tomas



More information about the ffmpeg-devel mailing list