summaryrefslogtreecommitdiffstats
path: root/libass/ass_utils.h
Commit message (Collapse)AuthorAgeFilesLines
* Parse and animate all colors and alpha values like VSFilterOleg Oshmyan2015-05-251-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow exactly one of these prefixes in header values: 0x, 0X, &h, &H. Note that "0x0xFFFFFF" is a correct value, as the first 0x is consumed by the parser and the second by the string-to-number conversion following strtol semantics. * Allow arbitrary numbers of leading & and H (and not h) in any order in override tag values. * Reduce header values modulo 2**32 instead of saturating them to LLONG_MIN/MAX. * Saturate override tag values to INT32_MIN/MAX rather than to LLONG_MIN/MAX. * Don't fiddle with bytes in alpha override tag values. (They can be outside of the 0..255 range.) Also change the byte swapping code to be more sensible. Fixes #80. Fixes #145. Fixes #178. Also fixes our behavior in the case described in https://code.google.com/p/xy-vsfilter/issues/detail?id=80.
* Fix a wrong commentOleg Oshmyan2015-05-231-1/+1
|
* Fix range in rot_keyRodger Combs2015-03-121-1/+1
| | | | Oops, trig is hard. We output from -pi to +pi now.
* Fix degrees/radians cache confusion; avoid a fixed-point overflowRodger Combs2015-03-121-2/+2
| | | | Also fix an incorrect comment
* Provide a strndup() fallbackwm42014-11-171-0/+7
| | | | | This standard function is not available everywhere, so we detect it and provide a fallback if missing.
* Check bitmap allocation for overflowswm42014-11-161-0/+2
| | | | | | | | This actually fixes #146. The overflow check itself is obvious. Also, make ass_align() return an unaligned value if aligning it would overflow. This is probably better, as it for example makes the overflow check in the caller simpler.
* Add another helper-macro for array allocationwm42014-11-141-0/+15
|
* Add ass_realloc_array()wm42014-11-111-0/+2
| | | | Helps with overflow and allocation failure checking.
* Provide SIZE_MAX fallbackwm42014-11-091-0/+4
| | | | | SIZE_MAX is in C99, but not in C89. It is in <stdint.h>, and is always a macro, so this fallback should be pretty portable and cause no issues.
* Fix UB at left shifts of negative integersDr.Smile2014-11-071-3/+3
|
* parse_tag: remove unnecessary mallocOleg Oshmyan2014-06-061-1/+1
|
* Parse override tag arguments exactly like VSFilter 2.38Oleg Oshmyan2014-06-061-1/+1
| | | | | Also replace strtocolor in ass_utils with string2color from ass.c, because that is more useful everywhere now.
* Move (r)skip_spaces to ass_utilsOleg Oshmyan2014-06-061-0/+2
|
* Use a function for aligned memory allocationswm42014-02-021-0/+8
| | | | ...instead of doing this manually.
* Unroll FNV-1A hash functionGrigori Goronzy2014-01-291-4/+9
| | | | Unroll the hash function with Duff's device for improved performance.
* Added x86 ASM functions11rcombs2014-01-251-0/+6
|
* Combine bitmaps before applying blur and shadow11rcombs2014-01-251-0/+1
|
* Simplify hash function11rcombs2014-01-251-7/+4
| | | | | | | | | We can rely on fast multiplication and good compilers. v2: use default FNV-1a prime Signed-off-by: wm4 <wm4@nowhere> Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* Fix \r style lookupOleg Oshmyan2013-06-221-0/+1
| | | | | Make \rSTYLENAME with an invalid STYLENAME fall back to line style rather than to Default. This fixes issue #104.
* Support reading the YCbCr Matrix headerOleg Oshmyan2013-03-031-0/+1
| | | | | | | | | | | | The value is parsed and stored as an enum constant that the consumer can read from ASS_Track. All output images are still plain RGB, and the consumer is expected to perform its own color correction. Supported header values: (TV|PC).(601|709|240M|FCC) and None. If the header is missing, a special compatibility value is used that should be treated as TV.601 if the accompanying video stream is YCbCr and as None otherwise. If the header is present but has an invalid/unknown value, a different special value is substituted.
* Support \rSTYLENAME syntaxGrigori Goronzy2012-03-111-0/+1
| | | | | This allows to reset to a certain style, instead of the default style for the current line. For some reason, this was completely missing.
* 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.
* Improve rotation cache accuracyGrigori Goronzy2010-01-071-0/+15
| | | | | | In some cases 16.16 precision is not good enough. Instead use 10.22 and use modulo 360.0 on the angles to make overflows impossible and improve cache hit ratio sometimes.
* Replace strtod with locale-independent strtodGrigori Goronzy2010-01-051-0/+3
| | | | | | | | | strtod respects the locale and in some locales, the decimal separator is not a point, leading to parsing errors in tags like \pos(23.4,5), which are perfectly valid. As there isn't a really portable way to use a particular locale just for one call to strtod, reimplement it. The implementation was taken from the 1.8 branch of Ruby.
* Always parse colors as hex for ASS tracksGrigori Goronzy2009-08-121-1/+1
| | | | | | According to the ASS specification, colors can only be specified in hex. Modify the color parsing accordingly; this especially means that colors where the hex sigil (the "H") is missing can now be parsed.
* Rename typedefs (breaks API)Grigori Goronzy2009-08-061-3/+3
| | | | | | 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.
* Clamp clip rectangle to frame sizeGrigori Goronzy2009-07-211-0/+1
| | | | | Make sure the clip rectangle is inside the screen boundaries. Idea by Evgeniy Stepanov.
* Message callback funtionalityGrigori Goronzy2009-07-111-4/+9
| | | | | | | | | | | 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]".
* Replace string defines with real stringsGrigori Goronzy2009-07-111-2/+0
| | | | | | Instead of referencing string defines from help_mp.h, use the strings directly in ass_msg. Consequently, help_mp.h is useless and can be deleted.
* Move gaussian blur into bitmap handling codeGrigori Goronzy2009-07-101-3/+0
|
* Implement drawing mode (\p)Grigori Goronzy2009-07-061-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Incorporate mputils.c into ass_utils.cGrigori Goronzy2009-06-271-0/+28
| | | | | | 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.
* Reindent all source code.greg2009-06-201-29/+37
| | | | | | | | | | | | | | | 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
* Support ScaledBorderAndShadow property.greg2009-03-051-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28820 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove unused function argument.eugeni2009-02-271-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28753 b3059339-0415-0410-9bf9-f77b7e298cf2
* Support fractional arguments for some override tags.eugeni2009-02-271-0/+1
| | | | | | | Done by parsing all integers as doubles first and then converting them to the nearest integer. Patch by Grigori G (greg chown ath cx). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28752 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/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26170 b3059339-0415-0410-9bf9-f77b7e298cf2
* Comment out dump_glyph(): it is unused and, as it is now, breaks compilation.eugeni2008-02-221-1/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26068 b3059339-0415-0410-9bf9-f77b7e298cf2
* Some debugging routines.eugeni2008-02-221-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26066 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
* Limit ass_font_set_transform to nonrotating transformations.eugeni2007-05-141-0/+6
| | | | | | | | Rotations are not needed here (they are performed in transform3d) and they disable autohinter. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23317 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move conversions between 16.16, 26.6 fixed point and int, double to separateeugeni2007-02-161-0/+26
| | | | | | | functions. Some rounding errors are fixed along the way. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22231 b3059339-0415-0410-9bf9-f77b7e298cf2
* Revert r20517.eugeni2006-10-291-6/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20519 b3059339-0415-0410-9bf9-f77b7e298cf2
* Copy the following functions to libass to avoid dependency on the rest of ↵eugeni2006-10-291-0/+6
| | | | | | | | | | | | mplayer: guess_buffer_cp utf8_get_char blur git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20517 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
* Initial libass release (without mencoder support).eugeni2006-07-071-0/+9
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18942 b3059339-0415-0410-9bf9-f77b7e298cf2