• Oliver Fromme's avatar
    avcodec/dvdsubenc: Add dvdsub workaround for some players · a32dcaaa
    Oliver Fromme authored
    The issue affects dvdsub subtitles (a.k.a. VOBSUB).
    
    Some players -- in particular hardware players -- cut off
    the lowest row of pixels if the number of rows in the subtitle
    is odd.
    
    The patch below implements a work-around for that.  If the
    number of rows is odd, it is simply rounded up to an even
    number, adding an invisible (i.e. fully transparent) row.
    The work-around can be enabled or disabled with a new
    option -even_rows_fix.  The default is disabled, so there
    is no change of behaviour for users who don't care about it.
    
    The overhead for the fix is low, and in many cases even zero:
    For subtitles with an odd number of rows (i.e. in 50% of
    cases on average), the size increases by two bytes because
    a fully transparent row is encoded as 0x00 0x00.  However,
    in the VOBSUB standard, all data packets are padded to 2KB
    anyway, so in most cases the additional bytes just use some
    part of the padding, so there is no overhead.  Only in the
    rare case that the 2KB boundary is hit (0.1% chance), a full
    2KB block is added.
    Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
    a32dcaaa
dvdsubenc.c 15.1 KB