aboutsummaryrefslogtreecommitdiffhomepage
path: root/mpcommon.c
diff options
context:
space:
mode:
authorGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2009-09-02 20:21:24 +0300
committerGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2009-09-05 06:25:47 +0300
commitd9cea6a98b1f0879c163e198061f1380c5ee8432 (patch)
treedbc78044c5211f09c603c116aa1cb495172dd0d0 /mpcommon.c
parent575331d73cf3a992c779cca7f90ae4810d17dcfc (diff)
vo_vdpau: Allocate one large surface for EOSD content
Create a single large bitmap surface for EOSD objects and pack all the bitmap rectangles inside that. The old code created a separate bitmap surface for every bitmap and then resized the cached surfaces when drawing later frames. The number of surfaces could be large (at least about 2000 for one sample subtitle script) so this was very inefficient. The old code also used a very simple strategy for pairing existing surfaces to new bitmaps; it could resize tiny surfaces to hold large glyphs while using existing large surfaces to hold tiny glyphs and as a result allocate arbitrarily much more total surface area than was necessary. The new code only supports using a single surface, freeing it and allocating a larger one if necessary. It would be possible to support multiple surfaces in case of hitting the maximum bitmap surface size, but I'll wait to see if that is actually needed before implementing it. NVIDIA seems to support bitmap surface sizes up to 8192x8192, so it would take either a really pathological subtitle script rendered at a high resolution or an implementation with lower limits before multiple surfaces would be necessary. The packing algorithm should successfully pack the bitmaps into a surface of size w*h as long as the total area of the bitmaps does not exceed 16/17 (w-max_bitmap_width)*(h-max_bitmap_height), so there should be no totally catastrophic failure cases. The 16/17 factor comes from approximate sorting used in the algorithm. On average performance should be better than this minimum guaranteed level.
Diffstat (limited to 'mpcommon.c')
0 files changed, 0 insertions, 0 deletions