summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-09-02 20:21:24 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-09-05 06:25:47 +0300
commitd9cea6a98b1f0879c163e198061f1380c5ee8432 (patch)
treedbc78044c5211f09c603c116aa1cb495172dd0d0 /TOOLS
parent575331d73cf3a992c779cca7f90ae4810d17dcfc (diff)
downloadmpv-d9cea6a98b1f0879c163e198061f1380c5ee8432.tar.bz2
mpv-d9cea6a98b1f0879c163e198061f1380c5ee8432.tar.xz
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 'TOOLS')
-rw-r--r--TOOLS/vdpau_functions.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py
index 386d70ab33..84e79d647b 100644
--- a/TOOLS/vdpau_functions.py
+++ b/TOOLS/vdpau_functions.py
@@ -8,6 +8,7 @@ get_error_string
bitmap_surface_create
bitmap_surface_destroy
bitmap_surface_put_bits_native
+bitmap_surface_query_capabilities
decoder_create
decoder_destroy
decoder_render