[FFmpeg-devel] Scaling PAL8 images with alpha
Michael Niedermayer
michael at niedermayer.cc
Fri Sep 24 18:39:36 EEST 2021
On Fri, Sep 24, 2021 at 10:30:31AM +0000, Soft Works wrote:
> Hi,
>
> for a new filter, I want to rescale PAL8 subtitle bitmaps where the palette includes
> colors with alpha.
>
> From what I’ve seen, swscale doesn’t support PAL8-to-PAL8, only PAL8-to-BGR8
> which doesn’t support alpha and the palette is fixed with 256 entries defined by
> convention, while I would ideally like to be able to allow the following:
>
> - constrain the output to use the same palette as the input
> - adaptively quantize it to a palette with a configurable number of colors
>
> Thus it's about the palette quantization (with or without dithering) after
> scaling in RGBA. (or some cool algorithmic trick I'm not aware of)
>
> Is there any existing code that I could reuse? The closest I could find
> is pngenc, but I'm wondering whether there's something else/better
> somewhere in the ffmpeg libs that I haven't seen?
There are some non linear scaling filters which may make sense when you do
not have the full linear space available see:
hqx, epx, xbr
you could also try some neural net stuff
or the insane solution, OCR, scale text, render font into RGBA and then back to PAL8
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210924/4162d765/attachment.sig>
More information about the ffmpeg-devel
mailing list