[MPlayer-dev-eng] [PATCH] A new ASS renderer

Nicolas George nicolas.george at normalesup.org
Sun Sep 23 11:20:32 CEST 2012


Le duodi 2 vendémiaire, an CCXXI, Xidorn Quan a écrit :
> 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.

Ok, I see. I believe your patch could be split into smaller components,
making it easier to review and eventually apply:

* Keep track of the extents of the "dirty" lines, to avoid up/downscaling a
  whole line for a single char. Simple minor optimization, interesting by
  itself.

* Vectorized implementations of the blending functions.

* Merge the image elements into a temporary image. To avoid duplicating the
  filter, it can be just an option that activate a slightly different code
  path inside the filter.

There are other possible optimizations. I can suggest at least two of them:

* Detect overlapping image elements (glyph body, outline and shadow) and
  combine only them in an intermediate image.

* Downscale the alpha channel instead of upscaling the target image.

Also, a few benchmarks would be nice. Blending an alpha channel with a
single color is simpler and more cache-friendly than blending an alpha
channel with a color channel, so it may happen that doing the first thrice
would be faster than the latter.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20120923/ff142880/attachment-0001.asc>


More information about the MPlayer-dev-eng mailing list