[FFmpeg-devel] [PATCH] Fix colors for DVD subtitles

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Apr 26 22:08:16 CEST 2011


On Tue, Apr 26, 2011 at 09:20:50PM +0200, Alexandre Colucci wrote:
> As per the DVD specifications and the DVD implementation guidelines, the alpha values are meant to be in increasing order for the 4 color indexes. In particular see section 5.4.3 Allocation of pixel data:
> 
> 00 - Background pixel
> 01 - Pattern pixel
> 10 - Emphasis pixel-1
> 11 - Emphasis pixel-2
> 
> All commercial DVDs adhere to this. The way this was meant by the DVD committee was to allow implementors to choose any index values in the 0-15 range in *ascending* order.

I am not exactly convinced, I have seen this guess_palette algorithm
both work an fail, if all adhered to this it should fail for
all cases with more than one non-transparent colour.

> Just compare the attached screenshots attached to the patch, they speak for themselves. The screenshots are from Con Air btw, not from some handmade source.

I don't doubt that it works for your case, I just don't believe it
works for all (even just all commercial) DVDs.
There is also the issue that for e.g. a opaque colors you change
the brightness levels from 0.5 and 1 to 0 and 1 which I don't
think is correct for DVDs that use them only for alpha-blending,
which is a quite common use.
What do you think about attached patch? It uses a table that makes
it less confusing/obfuscated which values are picked and also tries
to guess which way to order them.

> That said, the correct way is really not "guessing" but really using the actual color table in the PGC, see 4.3 Program Chain Information (7) PGC_SP_PLT in the DVD specifications. That is what VLC does and that is why they do not use this code (one of the reasons to be more precise), the guessing is really just a crutch for standalone vob files.

You're really supposed to use .idx files for standalone subs that
contain the proper palette and more stuff.
However I can't imagine VLC does not have similar guessing code, at
least MPlayer does.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dvdsub.diff
Type: text/x-diff
Size: 2218 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110426/d1081055/attachment.bin>


More information about the ffmpeg-devel mailing list