summaryrefslogtreecommitdiffstats
path: root/libass
Commit message (Collapse)AuthorAgeFilesLines
* Implement drawing mode (\p)Grigori Goronzy2009-07-068-68/+694
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove read_file_recode from APIGrigori Goronzy2009-07-012-3/+1
| | | | | | read_file_recode is only used internally in ass_read_file and shouldn't be exposed in the API. Remove the prototype from ass.h and declare it static.
* Scale letter spacing with font scaleGrigori Goronzy2009-07-011-1/+2
|
* Scale rotation constants with font scaleGrigori Goronzy2009-07-011-10/+15
| | | | | | | | Rotations use a "magic" constant of, by default, 20000. This number is more or less taken from VSFilter; I'm not even really sure what is (viewing distance, maybe), but scaling it according to font_scale solves problems with distortions of rotations in case the rendering resolution differs from the video resolution.
* Assume pixel ratio equals aspect ratioGrigori Goronzy2009-07-011-1/+3
| | | | | | In ass_set_frame_size pixel_ratio will be set alongside aspect ratio to the same value. This makes it possible to use libass without explicitely specifying an aspect ratio.
* Support for \iclip (inverse clipping)Grigori Goronzy2009-06-301-2/+127
| | | | | | | | | Inverse clipping means to display everything outside the clipping rectangle. It is implemented by splitting up a bitmap into up to 4 parts, as needed by the clipping rectangle. Afterwards, the bitmap is clipped against the screen boundaries as usual. Finally, each bitmap is split up into left and right and colored different, in case \kf karaoke is in effect.
* Fix karaoke (\kf) timingGrigori Goronzy2009-06-301-3/+3
| | | | | | The timing for the \kf karaoke which gradually fills the character from left to right, uses clipping and isn't aware of subpixel accuracy. This is simply fixed by casting these value to int.
* Move subpixel shift out of transform_3dGrigori Goronzy2009-06-291-10/+19
| | | | | | Instead of adding the subpixel shift to the glyph in transform_3d, do it directly in get_bitmap_glyph. This saves a few cycles for glyphs that are not transformed (rotated or sheared).
* API: make process_force_style availableGrigori Goronzy2009-06-293-3/+6
| | | | | Rename process_force_style to ass_process_force_style and make it available in the DSO.
* PAR correction for rendering at non-video resolutionGrigori Goronzy2009-06-292-4/+8
| | | | | | | | | | | | | | | The most prominent ASS/SSA renderer (VSFilter) conveniently ignores the real aspect ratio, and everyone seems to rely on that. This is fine when the subtitles are rendered before anamorphic video is stretched to its native aspect ratio, but results in wrongly stretched text with native renderers (EOSD). It can be fixed by making libass aware of the pixel ratio of the video. ass_set_aspect_ratio now requires an extra argument that specifies the pixel ratio, which is just width / height of the video after decoding. Glyphs are stretched in x direction before transformation (rotation, shearing), so there are still issues with transformed glyphs to be fixed.
* Restrict symbols exported in the DSOGrigori Goronzy2009-06-292-0/+32
| | | | | | Only export those symbols into the shared object which are defined in the API (ass.h). A file libass.sym which contains a list of symbols was added and libtool configured to use it.
* Fix two-pass stroking for \xbord, \ybordGrigori Goronzy2009-06-291-2/+3
| | | | | | | | The two-pass stroker blindly assumed that the number of points of the stroked glyph is the same, no matter the size of the stroker. Unfortunately, this is not the case every time. In such cases, the coordinates will only be replaced up to mininum of points of both glyphs. It's incredibly hacky, but seems to work well (and look good).
* Handle conflicting \t time intervalsGrigori Goronzy2009-06-291-2/+2
| | | | | If end <= start for a time interval specification, set end to the end of the event. VSFilter handles it like that, too.
* shift_bitmap: do not rely on compiler optimizationsGrigori Goronzy2009-06-291-4/+4
| | | | Do not rely on the compiler for optimizing a division into a shift.
* Subpixel accurate shadow renderingGrigori Goronzy2009-06-294-6/+72
| | | | | | | | | Shadows are handled different from glyph and outline. A shadow is the sum of glyph and outline bitmap; therefore shifting to the correct subpixel amount before rasterization is out of the question. Instead, the bitmap is shifted by its subpixel amount after being built from shadow and glyph. The bitmap cache was extended for this.
* Fix subpixel shift calculation for negative coordinatesGrigori Goronzy2009-06-281-4/+4
| | | | | | The subpixel shift calculation was off in case the device coordinates were negative. This has been corrected and the calculation been simplified.
* Make \shad, \xshad and \yshad animatable.Grigori Goronzy2009-06-271-8/+15
|
* Support \xshad and \yshad override tagsGrigori Goronzy2009-06-271-16/+22
| | | | | | Split up shadow displacement into x and y and allow parsing of the tags \xshad and \yshad to set it. This makes it possible to displace a shadow differently in x and y direction.
* Support \xbord and \ybord override tagsGrigori Goronzy2009-06-272-41/+117
| | | | | | | | | | | Improve get_outline_glyph with a second pass which can be used for stroking with different width in x and y direction. This is done by first stroking in y direction, and if the stroke size for the x direction differs, stroking a copy of the glyph in x direction again. The x coordinates of the first stroker result are afterwards replaced by the coordinates of the second stroking. The cache hash keys for bitmaps and glyphs have been extended to carry the new properties.
* Fix memory leak in render_overlapGrigori Goronzy2009-06-271-7/+4
| | | | | | | | render_overlap allocated memory for its hashmap key and values on the heap, relying on the cache cleanup to free them. However, these pointers are not directly inserted into the cache, but memcpy()'ed in hashmap_insert, leading to a pretty bad memory leak. Allocate the key and value on the stack instead to fix this problem.
* Fix strdup() string leaksGrigori Goronzy2009-06-272-0/+8
| | | | | On two occassions strings where strdup()'ed but never freed. Fix these two small memory leaks.
* Make \fax and \fay animatable.Grigori Goronzy2009-06-271-2/+4
|
* Fix rotation and subpixel placementGrigori Goronzy2009-06-271-2/+4
| | | | | Add subpixel shift to the points after rotation transformations to fix rotations and subpixel accuracy.
* Include ass_utils.h instead of mputils.hGrigori Goronzy2009-06-277-8/+3
|
* Incorporate mputils.c into ass_utils.cGrigori Goronzy2009-06-275-286/+226
| | | | | | Move helper functions originating from MPlayer into ass_utils.c. Remove some debugging code that is #if 0'ed for ages now. Delete mputils.c and mputils.h and remove them from the build system.
* Cosmetics: minor cleanup in ass_render_eventsGrigori Goronzy2009-06-271-5/+1
|
* Cosmetics: fix a few remaining declarationsGrigori Goronzy2009-06-272-9/+9
| | | | | Fix formatting of a few remaining declarations missed in the first cleanup.
* Rename various non-static functionsGrigori Goronzy2009-06-276-23/+23
| | | | | Rename a few functions to avoid symbol clashes. Clean up mputils.h.
* Rename mp_msg to ass_msgGrigori Goronzy2009-06-279-131/+120
|
* Add standard GPL header to mputils.cGrigori Goronzy2009-06-271-0/+21
|
* Improve positioning for full subpixel accuracyGrigori Goronzy2009-06-271-127/+135
| | | | | | | | | | | | Completely overhaul positioning for full subpixel accuracy (as much as FreeType offers, 1/64 pixel) for all positioning/typesetting related calculations and the final rendering. Positions are now calculated with doubles. FreeType uses a fixed-point 26.6 representation internally. Where needed, these are converted into double values as well. Finally, for the on-screen rendering, a subpixel shift for the rasterization is calculated (bitmaps cannot be rendered onto the video with subpixel accuracy).
* Correct vertical glyph positioning for \fayGrigori Goronzy2009-06-241-0/+2
| | | | | | | Offset the next glyph by the total shear of the glyph before. This is done before line-wrapping, so that a line that is vertically sheared will get as much higher, as it is sheared. Fine by me, but vsfilter probably does it in a different way.
* Initial support for \fax, \fay override tagsgreg2009-06-232-16/+33
| | | | | | | This adds support for the \fax and \fay override tags which can be used for shearing the text horizontally and vertically. At the moment, this works correctly on a per-glyph basis, however, the glyph positioning is wrong, which is especially evident with \fay.
* Use safe hash functions for composite bitmapsUoti Urpala2009-06-203-9/+26
| | | | | | | | | | | | | | | 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.
* ass_cache_template.c: Undo automatic reindent for this fileUoti Urpala2009-06-201-21/+31
| | | | | The 'indent' program does not understand the macro trickery in this file and the result was clearly worse than the original.
* Add hack to support empty lines of textgreg2009-06-201-0/+8
| | | | | | | Consecutive forced breaks (\N\N) can be used to create empty lines of text in other renderers. This doesn't work with the current text layouter (wrap_lines_smart). This hack inserts a space glyph between two consecutive forced breaks to get around this limitation.
* Remove static variable modifier in sub_recodegreg2009-06-201-1/+1
| | | | A variable was needlessly static, this has been corrected.
* ass_set_fonts: optionally pass fontconfig config pathgreg2009-06-204-9/+19
| | | | | | | Optionally pass a fontconfig config file to the fontconfig initialisation. This changes the public API.
* Remove wrappers for ass_set_fontsgreg2009-06-202-17/+3
| | | | | | | | | ass_set_fonts_ was wrapped through ass_set_fonts and ass_set_fonts_nofc to either use fontconfig or not. This is not very useful, since a simple parameter to ass_set_fonts_ can be used instead. Remove the wrapper functions and rename the real function to ass_set_fonts. This changes the public API.
* Silence warnings introduced by -Wallgreg2009-06-203-9/+8
| | | | | Silence a few warnings that should be harmless and were introduced by the -Wall option.
* Replace manual fixed-point conversiongreg2009-06-201-2/+2
| | | | Replace a manual fixed-point conversion to d16 by conversion function.
* Reindent all source code.greg2009-06-2020-4660/+5189
| | | | | | | | | | | | | | | 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
* Do not print message level of a string (bloats output) and change thegreg2009-06-201-2/+1
| | | | message level to MSGL_INFO.
* Fix up glyph stroker to avoid buggy rendering.greg2009-06-201-2/+79
| | | | | | This adds pre-processing to the stroker which removes certain contours that'd lead to areas wrongly getting not filled. The approach is very simple, but works well enough for most cases.
* Set a more reasonable maximum blur radius and make \blur animatable.greg2009-06-191-1/+2
|
* Enlarge glyph size more for \blur to avoid artefacts.greg2009-06-191-1/+1
|
* Remove MAX_GLYPHS and MAX_LINES limits. Instead, dynamically allocategreg2009-06-191-15/+20
| | | | memory and use reasonable initial sizes.
* Remove cache globals; move cache data into a separate cache_store structgreg2009-06-195-109/+117
| | | | that is part of ass_renderer.
* Eliminate text_info global; move it into ass_renderer.greg2009-06-191-109/+109
|
* Eliminate render_context global; move it into ass_renderer.greg2009-06-191-311/+312
|
* Use ass_renderer to access settings instead of passing a pointer togreg2009-06-191-48/+50
| | | | ass_settings, where appropriate.
* Move frame_context into ass_renderer. This finishes the previousgreg2009-06-191-160/+145
| | | | elimination.
* Eliminate frame_context global, started.greg2009-06-191-133/+141
|
* Eliminate global_settings global.greg2009-06-191-69/+69
|
* Eliminate ass_renderer global.greg2009-06-191-34/+32
|
* Warn on \pos, \move redefinitionsgreg2009-06-191-1/+4
| | | | | Optionally output a warning when a \pos or \move is redefined in a single subtitle line.
* ass_render.c: declare functions staticgreg2009-06-191-3/+3
| | | | Declare some functions only used in this file static.
* From uau: libass: Fix cache lookup problem causing memory bloatgreg2009-06-193-33/+101
| | | | | | | | | | | | | | | | | | | | | | 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).
* Add autotools infrastructure.greg2009-06-181-0/+14
|
* Apply initial changes needed for standalone libass.greg2009-06-185-368/+307
|
* Add a missing check for a NULL return value.eugeni2009-06-161-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29367 b3059339-0415-0410-9bf9-f77b7e298cf2
* whitespace cosmetics: Remove all trailing whitespace.diego2009-05-1312-144/+144
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Don't automatically wrap lines when WrapStyle==2.eugeni2009-04-211-1/+1
| | | | | | \n and \N still work. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29219 b3059339-0415-0410-9bf9-f77b7e298cf2
* Document the ass_render_event event_images parameter.reimar2009-03-281-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29087 b3059339-0415-0410-9bf9-f77b7e298cf2
* Initialize all structs to 0 before using them.reimar2009-03-281-0/+3
| | | | | | | | | | This is consistent with the remaining code (which uses e.g. calloc) and makes it easier to extend the structs in the future. As a side effect it fixes several valgrind errors in hashmap_hash/hashmap_key_compare caused by padding in the structures, but it is not a correct fix for that issue. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29086 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: reindent.eugeni2009-03-161-5/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28977 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix uninitialized memory access in ass_fontconfig.eugeni2009-03-161-0/+2
| | | | | | | This fixes hangups with plaintext subtitles happening when the first subtitle is about to be displayed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28976 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use ScaledBorderAndShadow: yes by default.greg2009-03-111-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28935 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: reindent.eugeni2009-03-081-25/+25
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28896 b3059339-0415-0410-9bf9-f77b7e298cf2
* Treat -font/-subfont as Fontconfig pattern in libass.eugeni2009-03-088-13/+31
| | | | | | Patch by Adrian Stutz (adrian sttz ch). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28895 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove extraneous braces.greg2009-03-081-4/+4
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28892 b3059339-0415-0410-9bf9-f77b7e298cf2
* Don't assume width == stride for bitmap composition.greg2009-03-081-6/+8
| | | | | | Fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1421 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28891 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix clipping for pan-and-scan.greg2009-03-081-4/+6
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28876 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add a proper color check to the overlap compositing.greg2009-03-081-0/