[MPlayer-dev-eng] [PATCH] A new ASS renderer
Xidorn Quan
quanxunzhen at gmail.com
Sun Sep 23 02:29:28 CEST 2012
On Sun, Sep 23, 2012 at 3:24 AM, Nicolas George <
nicolas.george at normalesup.org> wrote:
> Le primidi 1er vendémiaire, an CCXXI, Clément Bœsch a écrit :
> > I'd unfortunately say that ASS performance is relevant when rendering
> > complex karaoke or stuff like that, where the subtitles change all the
> > time.
>
> That is true, but this patch specifically does not help with that
> particular
> case. In fact, it has been said that it made things slightly worse in this
> case.
>
Yes, because it has to maintain an additional alpha channal which
the current one doesn't need.
If I understand things correctly, there are two performance issues with the
> way mplayer implements ASS blending: first, if several images overlap, the
> blending on that area is done once per image. This is especially common
> with
> ASS since each glyph has usually a body, an outline and a shadow, all
> covering roughly the same area. Second, chrominance rendering is done by
> first upscaling to the full resolution and then downscaling to the
> chrominance subsampling.
>
> The patch is too big for me to see at a first glance, but I suppose it
> addresses the first problem, at the cost of doing the blending also in
> areas
> that are not covered in glyphs. In other words, if "Hello World" is to be
> rendered, the current code does it thrice for each of the 10 letters while
> the proposed code would do it once for the whole sentence, including the
> space. Depending on the layout and the exact implementation, it may or may
> not be a global gain.
>
This patch addresses the first problem you said. It renders the whole
sentence once, and reuse it for frames where subtitle keep unchanged.
And in fact, this renderer is also partially optimized for the second
problem at the same time.
The workflow for the current renderer is: upsampling all rows which
will be rendered on from the origin frame, rendering subtitles,
then downsampling. In this new renderer, because every pixel will be
visited no more than once, we just need to upsample and downsample
the pixels we need instead of the whole rows. So this renderer may
also perform better for vertical subtitles in which pixels need to be
rendered in a row is far fewer than those of a whole row even if
the subtitles change every frame.
More information about the MPlayer-dev-eng
mailing list