summaryrefslogtreecommitdiffstats
path: root/libass/ass_cache.h
Commit message (Collapse)AuthorAgeFilesLines
* cache: switch to wyhash for cache tablesrcombs2021-10-181-1/+1
| | | | This is dramatically faster on files with large drawings.
* cache: give the hash a more generic function namercombs2021-10-151-1/+2
|
* render: match VSFilter's behavior when painting fill in shadow/borderrcombs2020-08-301-3/+5
| | | | | | | Some releases rely on this. See corresponding VSFilter code: https://github.com/Cyberbeing/xy-VSFilter/blob/cf8f5b27de77fe649341bfab0fdfd498e1ad2fa6/src/subtitles/RTS.cpp#L1270 https://github.com/Cyberbeing/xy-VSFilter/blob/cf8f5b27de77fe649341bfab0fdfd498e1ad2fa6/src/subtitles/RTS.cpp#L1291
* renderer: rearrange render flagsDr.Smile2019-05-201-1/+0
| | | | Compatibility flag FILTER_DRAW_SHADOW has removed completely.
* bitmap: remove level of indirection in bitmap functionsDr.Smile2019-05-201-7/+1
| | | | | This allows to use Bitmap struct directly as cache value and to remove bunch of unnecessary allocations.
* cache: remove level of indirection in glyph metrics valueDr.Smile2019-05-201-4/+0
|
* renderer: improve handling of subpixel shiftDr.Smile2019-05-201-5/+0
| | | | | | | Integral pixel shift is extracted in quantization function now, taking account of full glyph transformation and not only translation part of it. It makes program logic more straight and ensures that subpixel shift from cache key never exceed full pixel.
* Consolidate and quantize all transformationsDr.Smile2019-05-201-21/+9
| | | | | | | | | | | | | | This commit defers all outline transformations until rasterization stage. Combined transformation is then quantized and used as bitmap key. That should improve performance of slow animations. Also caching of initial and stroked outlines and bitmaps is now separate in preparation to proper error estimation for stroker stage. Note that Z-clipping for perspective transformations is now done differently compared to VSFilter. That clipping is mostly safety feature to protect from overflows and divisions by zero and is almost never triggered in real-world subtitles.
* cache: cleanupDr.Smile2019-05-191-5/+5
|
* cache: construct cache values only from corresponding keysDr.Smile2019-05-191-2/+4
| | | | | | | | | | | | | | | | | | | | This commit forces construction of cache values using only data available in its companion keys. That ensures logical correctness: keys are guaranteed to have all the necessary data, and prevents accidental collisions. Most fixes of cache logic correspond to minor problem when rendering is done with double parameter but cache key stores its approximate fixed-point representation. The only serious problem is missing scale of clip drawing. Also this commit removes unused scale parameters from glyph metrics cache key. Due to missing scale clip shapes that differed only in scale treated by cache system as identical. That can lead to incorrect reuse of cached bitmap of different scale instead of correct one. The only hack left is in glyph metrics cache with its unicode >= VERTICAL_LOWER_BOUND check.
* Eliminate advance.y from drawings and glyphsDr.Smile2019-05-191-1/+1
| | | | | Drawings always have advance.y = 0 and FreeType guarantees that for horizontal writing.
* Replace FreeType types with libass native typesDr.Smile2017-09-171-2/+2
| | | | | | FT_Vector and FT_BBox types are based on FT_Pos, which is alias of long. FreeType treats it as 32-bit integer, but on some platforms long can be 64-bit. That leads to wasted memory and suboptimal performance.
* renderer: fix handling of empty outlinesDr.Smile2017-07-311-0/+2
|
* renderer: switch to using two border outlines instead of oneDr.Smile2017-07-311-2/+3
|
* cache: keep referenced cache values alive after ass_cache_empty()Dr.Smile2016-06-301-3/+11
|
* cache: keep ref_count of all active objects nonzeroDr.Smile2016-06-301-3/+3
|
* cache: replace size_func with parameter in ass_cache_commit()Dr.Smile2016-06-301-3/+2
|
* cache: remove ass_cache_cancel(), cache failures insteadDr.Smile2016-06-301-3/+3
|
* cache: switch to gradual cache clearingDr.Smile2016-06-301-3/+8
| | | | | | | | | | | Advantages over the old algorithm consist of the following. * There are no glitches due to full cache clearing. Items are arranged into linked list ordered by time of last use. Only the oldest items get deleted at the clearing event. * Each item now keeps track of number of references. Referenced cache values are immune to clearing. * Reduced amount of total cache memory for the same performance. * Reduced number of memory allocations per cache item.
* Clean up bitmap combiningDr.Smile2015-01-281-2/+18
| | | | | | | | | | Now pre- and post-combining operations are clearly separated, many parameters in cache keys are no longer necessary due to that. Also an ambiguous (in case of multiple fonts) text string is replaced with a list of direct bitmap references in composite cache key. Fixes #153. Fixes #82.
* Replace FT_Outline with ASS_OutlineDr.Smile2014-11-231-3/+2
|
* Combine bitmaps before applying blur and shadow11rcombs2014-01-251-2/+4
|
* harfbuzz: cache glyph metricsGrigori Goronzy2011-07-291-0/+5
| | | | | | HarfBuzz' FreeType font functions do not cache anything and call FT_Load_Glyph all the time, which can be slow. Add a cache for metrics and use it with custom font functions.
* cache: unified bitmap cacheGrigori Goronzy2011-06-271-0/+11
| | | | | | Similarly to the glyph cache, subclass the bitmap cache to allow both outline bitmaps and clipping mask bitmaps to coexist in the same cache in a much cleaner way.
* cache: fix size tracking and emptyingGrigori Goronzy2011-06-271-23/+23
|
* cache: unified outline cache for glyphs/drawingsGrigori Goronzy2011-06-271-11/+26
| | | | | | | | | Glyphs and drawings have wildly different hash keys. Subclass the hash keys of glyphs and drawings in a new, unified outline cache. This also fixes some issues with drawings in the glyph cache. Now, the textual description of the drawing is included in the key (the hash value isn't really good enough, especially not fnv32) and the baseline offset is saved as well.
* Convert outline processing and caching from glyphs to bare outlinesGrigori Goronzy2011-06-201-2/+3
| | | | | | | | | This introduces functions to use and copy pointered outline objects easily and uses these instead of glyphs everywhere. Previously the glyph cache was abused for caching vector clipping masks, but this isn't possible anymore (nor desirable), thus vector clipping cache has been disabled for the moment.
* Add cache statisticsGrigori Goronzy2011-06-071-1/+2
|
* Much improved cache/hashmap implementationGrigori Goronzy2011-06-071-67/+21
| | | | | | | | - less code, cleaner - decoupled from ASS_Library - better data encapsulation - simpler interface - avoids a nasty hack
* Relicense to ISCGrigori Goronzy2010-09-281-12/+10
| | | | | | In hope to make libass as useful as possible, relicense libass to ISC, a simplified 2-clause BSD license. All contributors who provided non-trivial changes have granted their permission for this.
* Rename typedefs (breaks API)Grigori Goronzy2009-08-061-54/+54
| | | | | | Rename all typedefs from the convention foo_bar_t, which can possibly conflict with POSIX types, to FooBar (and ASS_FooBar for public API typedefs). Fix formatting and stray comments while at it.
* Clean up typedefs/structsGrigori Goronzy2009-07-281-6/+6
| | | | | Remove useless _s suffix from struct names and remove struct name where not needed (only the typedef'd struct is used). Clean up API headers.
* Introduce simple cache memory managementGrigori Goronzy2009-07-191-0/+1
| | | | | | | | | | | libass' cache was basically unmanaged; it would grow without any limits, depending on how complex the subtitles are. Introduce a simple limiting that resets the cache if certain limits are exceeded. The bitmap cache is limited to approx. 50 MB size by default, while the glyph cache allows storing up to 1000 glyphs by default. A few tests with rather heavily softsubbed fansubs show that these limits are fine. The API was extended with the function ass_set_cache_limits which allows modification of these limits.
* Updates for autotools' make distGrigori Goronzy2009-07-121-1/+1
| | | | | Rename ass_cache_template.c to ass_cache_template.h; add libass.sym to EXTRA_DIST.
* Message callback funtionalityGrigori Goronzy2009-07-111-5/+7
| | | | | | | | | | | Introduce functionality for providing a message callback that is used for passing messages to the controlling application instead of simply printing them to standard output. The function pointer to the callback is stored in the ass_library_t instance. ass_msg needs access to it, so in many places the library instance needs to be passed around now. The default behavior is the old one: messages of MSGL_INFO or lower are printed to the standard output, prefixed with "[ass]".
* Implement drawing mode (\p)Grigori Goronzy2009-07-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finally implement the drawing mode, which allows drawing of custom vector graphics. Drawings are intercepted in ass_render_event; a hash of the drawing string is generated which is then used for looking up drawings and bitmaps of drawings in the cache. The drawings itself are "fake" glyphs. They are created by parsing the simple drawing description language, evaluating the curves described (lines, cubic beziers and/or a special kind of b-splines) and creating vector outlines. Afterwards, these drawings are (with a few exceptions, e.g. ascender/descender) exactly handled like regular glyphs. Support for vector clippings is still missing, but otherwise the implementation should be complete and compatible with VSFilter. The libass integration of the drawing parsing/processing code is still a bit sketchy and should be refactored. History: WIP: Drawing mode infrastructure WIP: Drawing tokenizer WIP: Parse drawing tokens, call evaluators WIP: Bezier/b-spline evaluator WIP: Final pieces for the drawing mode WIP: Heavy modifications to the drawing parser/tokenizer WIP: Dynamic outline memory allocation WIP: Drawing position fixes WIP: more drawing position fixup (similar to VSFilter now) WIP: Lots of cleanup and fixes for drawings. WIP: Drawing mode integration into ass_render_event
* Use safe hash functions for composite bitmapsUoti Urpala2009-06-201-8/+0
| | | | | | | | | | | | | | | Previously the composite bitmap hash keys were compared and hashed based on all the bytes in the struct, which could cause problems because of padding bytes. Change the code to use field-by-field operations as already done for other hash key types. The composite hash key contains two bitmap hash keys. The hashing function currently handles those by calling the function to calculate the corresponding bitmap hash, and then updating the composite hash by treating the result of the function call as a byte buffer. An alternative would be to change the hash functions so that the initial hash value could be passed as a parameter to the recursively called function.
* Reindent all source code.greg2009-06-201-58/+65
| | | | | | | | | | | | | | | Reindent complete source code (*.c, *.h) with indent, the exact command line being: indent -kr -i4 -bap -nut -l76 *.c *.h From now on, new code should use (more or less) K&R style, only spaces and no tabs, 4 spaces indent width. Avoid long lines. Fix function declaration pointer spacing. Remove spaces that were added to many function declarations by indent, like some_func(foo_t * bar). Fix indenting of macros in ass.c
* Remove cache globals; move cache data into a separate cache_store structgreg2009-06-191-31/+50
| | | | that is part of ass_renderer.
* From uau: libass: Fix cache lookup problem causing memory bloatgreg2009-06-191-31/+3
| | | | | | | | | | | | | | | | | | | | | | The cache code did hash lookups by storing key values in struct fields and then hashing and comparing the struct as a single memory block. In at least one case such a struct contained uninitialized padding bytes which prevented the complete memory area of the struct from matching even though the fields did. As a result the code failed to find existing objects in the cache and stored new versions of them, causing gigabytes of memory use in some circumstances. Initializing the struct memory to zero before writing the fields avoided such memory use in tests but is not guaranteed to work if I interpret the C standard correctly (the compiler is allowed to write garbage over padding bytes when changing struct member values). Change the code to use struct-specific hashing and comparison functions that work field by field to guarantee correct behavior. Create these by replacing the struct definition with a template that lists the fields and can be used the generate each of struct definition, hash function and compare function with some preprocessor magic (otherwise every field would need to be listed separately in all three).
* whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Combine adjacent overlapping, translucent glyph borders and shadows togreg2009-03-051-0/+21
| | | | | | | | avoid luminance build-up, which looks ugly. The resulting, modified bitmaps are stored in separate bitmap cache. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28824 b3059339-0415-0410-9bf9-f77b7e298cf2
* Allow \be with arguments other than 0 or 1. Implement \blur.eugeni2009-02-071-0/+1
| | | | | | Patch by Grigori G, greg at chown ath cx. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28471 b3059339-0415-0410-9bf9-f77b7e298cf2
* Speak of libass instead of MPlayer in the libass license headers.diego2008-05-141-4/+4
| | | | | | | | We already use LIBASS_ prefixes for the multiple inclusion guards. Thus libass can be considered separate enough to warrant this. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26770 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use standard license header.diego2008-05-131-16/+18
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26755 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add missing header #includes to fix 'make checkheaders'.diego2008-03-051-0/+4
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26170 b3059339-0415-0410-9bf9-f77b7e298cf2
* Consistently give all libass multiple inclusion guards a LIBASS_ prefix.diego2008-01-291-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25927 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add explanatory comments to the #endif part of multiple inclusion guards.diego2007-12-311-2/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25563 b3059339-0415-0410-9bf9-f77b7e298cf2
* Do not use leading underscores in multiple inclusion guards, they are reserved.diego2007-07-021-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23709 b3059339-0415-0410-9bf9-f77b7e298cf2
* Support fractional font sizes.eugeni2007-05-141-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23318 b3059339-0415-0410-9bf9-f77b7e298cf2
* Make cache_*_add functions return the pointer to new (copied) value.eugeni2007-05-031-4/+4
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23229 b3059339-0415-0410-9bf9-f77b7e298cf2
* Bugfix: glyph cache depends on border width, because it contains outline_glypheugeni2007-05-011-0/+1
| | | | | | | (glyph border obtained with FT_Glyph_StrokeBorder) since r23043. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23188 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add shift_[xy] (vector that is added to the glyph before transformation) toeugeni2007-04-201-0/+3
| | | | | | | | bitmap glyph key. Result of rotation depends on them because of perspective transformation. They are only set when some rotation take place. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23046 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove bbox and advance vector from bitmap cache.eugeni2007-04-201-2/+0
| | | | | | | They are now available from glyph cache. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23044 b3059339-0415-0410-9bf9-f77b7e298cf2
* Store outline_glyph (glyph border) in glyph cache.eugeni2007-04-201-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23043 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add outline glyph cache (unused yet).eugeni2007-04-201-0/+22
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23036 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rename glyph cache to bitmap cache.eugeni2007-04-201-14/+13
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23035 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add generic hash map implementation.eugeni2007-04-201-0/+12
| | | | | | | Reimplement both font cache and glyph cache on top of it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23034 b3059339-0415-0410-9bf9-f77b7e298cf2
* Implement \frx and \fry (and reimplement \frz) as 3d rotations.eugeni2007-02-161-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22233 b3059339-0415-0410-9bf9-f77b7e298cf2
* Consistently name z-axis rotation angle "frz".eugeni2007-02-161-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22232 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use (ass_font_t, char code) instead of (FT_Face, glyph index) to identifyeugeni2006-11-281-2/+2
| | | | | | | glyphs in cache. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21364 b3059339-0415-0410-9bf9-f77b7e298cf2
* Don't include freetype headers in other headers.eugeni2006-11-271-5/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21339 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move ass_font_desc_t and ass_font_t declarations to ass_font.h.eugeni2006-11-271-17/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21337 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move ass_font_t allocation to ass_font.h.eugeni2006-11-271-1/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21333 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move fonts-related code to a separate file.eugeni2006-11-261-0/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21293 b3059339-0415-0410-9bf9-f77b7e298cf2
* Make ass_new_font return ass_font_t struct (instead of just FT_Face).eugeni2006-11-261-1/+1
| | | | | | | Use it to access the font face. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21283 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move ass_font_t to header.eugeni2006-11-261-0/+7
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21282 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rename:eugeni2006-11-261-5/+5
| | | | | | | | | face_desc_t -> ass_font_desc_t face_cache_item_t -> ass_font_t *face* -> *font* git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21281 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add copyright notice and vim/emacs comments to libass and vf_ass.c.eugeni2006-10-011-0/+20
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20014 b3059339-0415-0410-9bf9-f77b7e298cf2
* Shadow support in libass.eugeni2006-09-241-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19971 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add \be (blur edges) support to libass.eugeni