]> granicus.if.org Git - libass/log
libass
15 years agoconfigure: use pkg-config for libpng, enca
Grigori Goronzy [Sat, 11 Jul 2009 00:38:21 +0000 (02:38 +0200)]
configure: use pkg-config for libpng, enca

Use pkg-config to check for enca and libpng, like it is already done
for freetype and fontconfig.
Also, use libass/ass.c instead of the test program, test/test.cpp,
as the unique source identification.

15 years agoMessage callback funtionality
Grigori Goronzy [Sat, 11 Jul 2009 00:18:51 +0000 (02:18 +0200)]
Message callback funtionality

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]".

15 years agoReplace string defines with real strings
Grigori Goronzy [Fri, 10 Jul 2009 21:55:02 +0000 (23:55 +0200)]
Replace string defines with real strings

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.

15 years agoMove gaussian blur into bitmap handling code
Grigori Goronzy [Fri, 10 Jul 2009 21:00:10 +0000 (23:00 +0200)]
Move gaussian blur into bitmap handling code

15 years agoSlight optimizations for \be, \blur
Grigori Goronzy [Fri, 10 Jul 2009 17:31:07 +0000 (19:31 +0200)]
Slight optimizations for \be, \blur

Enlarge bitmap glyphs less for \be, this is especially effective for
lots of \be applications.
Also make sure that the gaussian blur buffers are only updated if
gaussian blur is actually used for a particular glyph.

15 years agoUse better method for stroking with \xbord, \ybord
Grigori Goronzy [Wed, 8 Jul 2009 12:43:58 +0000 (14:43 +0200)]
Use better method for stroking with \xbord, \ybord

Instead of stroking in two passes using the regular stroker use
the outline emboldener in case different x and y stroke widths are
requested.

The regular outline stroker draws circular arcs, adding points to
the outline.  The number of points can vary according to the width
of the stroker.  This makes it impossible to reliably stroke in
two passes with it.
The outline emboldener does not produce outlines looking as nice
as the stroker outlines, but it never adds points to the outline,
making it suitable for two-pass emboldening with different x and y
width.

15 years agoCorrectly round doubles to integers
Grigori Goronzy [Tue, 7 Jul 2009 22:25:05 +0000 (00:25 +0200)]
Correctly round doubles to integers

mystrtoi and mystrtoll did not round correctly for negative numbers,
this was fixed.

15 years agoTurn down subpixel accuracy to 1/8th pixel
Grigori Goronzy [Tue, 7 Jul 2009 22:07:52 +0000 (00:07 +0200)]
Turn down subpixel accuracy to 1/8th pixel

Using the full accuracy range of 1/64th pixel seems unnecessary--1/8th
pixel is "good enough".  Mask out the three lowest bits to lower cache
and CPU usage; a short test shows that this almost halves the amount
of glyphs with different subpixel shifts being generated and cached.

15 years agoSupport for underline and strikethrough
Grigori Goronzy [Tue, 7 Jul 2009 18:25:55 +0000 (20:25 +0200)]
Support for underline and strikethrough

Add support for the underline (\u) and strikethrough/strikeout (\s)
properties.  This is a bit tricky, since FreeType doesn't offer
any method of adding the lines, so you have to draw them yourself.
libass uses various information from TrueType tables to get position
and size of the lines, does a few simple consistency checks (some fonts
might be broken) and if everything is alright, adds new contours for
the lines.

Sometimes, rendering errors can occur:
- Currently, kerning isn't taken into account, which means the lines
can overlap a little, leading to small optical glitches.
- Some (broken) fonts use the wrong winding direction.  In this case,
the FreeType stroker will only consider the added lines to be "outside"
and only stroke the line instead of the whole glyph.

15 years agoTest program: check track initialization
Grigori Goronzy [Thu, 2 Jul 2009 14:43:24 +0000 (16:43 +0200)]
Test program: check track initialization

Stop in case the track initialization fails.  This fixes a crash.

15 years agoFix crash when event format spec is missing
Grigori Goronzy [Thu, 2 Jul 2009 14:37:52 +0000 (16:37 +0200)]
Fix crash when event format spec is missing

libass didn't properly initialize its idea about the event format
specification (the Format: line in the [Events] section) in case none
was explicitly specified.  This ends in a crash due to access to a null
pointer.  It was changed so that the event format is initialized to
a reasonable default, the way it is also done for embedded subtitles.

15 years agoImplement drawing mode (\p)
Grigori Goronzy [Mon, 6 Jul 2009 02:13:24 +0000 (04:13 +0200)]
Implement drawing mode (\p)

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

15 years agoRemove read_file_recode from API
Grigori Goronzy [Wed, 1 Jul 2009 14:22:27 +0000 (16:22 +0200)]
Remove read_file_recode from API

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.

15 years agoScale letter spacing with font scale
Grigori Goronzy [Wed, 1 Jul 2009 10:31:52 +0000 (12:31 +0200)]
Scale letter spacing with font scale

15 years agoScale rotation constants with font scale
Grigori Goronzy [Tue, 30 Jun 2009 22:49:28 +0000 (00:49 +0200)]
Scale rotation constants with font scale

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.

15 years agoAssume pixel ratio equals aspect ratio
Grigori Goronzy [Tue, 30 Jun 2009 22:16:20 +0000 (00:16 +0200)]
Assume pixel ratio equals aspect ratio

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.

15 years agoSupport for \iclip (inverse clipping)
Grigori Goronzy [Tue, 30 Jun 2009 11:39:14 +0000 (13:39 +0200)]
Support for \iclip (inverse clipping)

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.

15 years agoFix karaoke (\kf) timing
Grigori Goronzy [Tue, 30 Jun 2009 11:10:03 +0000 (13:10 +0200)]
Fix karaoke (\kf) timing

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.

15 years agoMove subpixel shift out of transform_3d
Grigori Goronzy [Mon, 29 Jun 2009 16:57:18 +0000 (18:57 +0200)]
Move subpixel shift out of transform_3d

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).

15 years agoAPI: make process_force_style available
Grigori Goronzy [Mon, 29 Jun 2009 15:22:52 +0000 (17:22 +0200)]
API: make process_force_style available

Rename process_force_style to ass_process_force_style and make it
available in the DSO.

15 years agoPAR correction for rendering at non-video resolution
Grigori Goronzy [Mon, 29 Jun 2009 15:05:44 +0000 (17:05 +0200)]
PAR correction for rendering at non-video resolution

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.

15 years agoRestrict symbols exported in the DSO
Grigori Goronzy [Mon, 29 Jun 2009 12:16:46 +0000 (14:16 +0200)]
Restrict symbols exported in the DSO

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.

15 years agoFix two-pass stroking for \xbord, \ybord
Grigori Goronzy [Mon, 29 Jun 2009 03:19:40 +0000 (05:19 +0200)]
Fix two-pass stroking for \xbord, \ybord

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).

15 years agoHandle conflicting \t time intervals
Grigori Goronzy [Mon, 29 Jun 2009 02:17:24 +0000 (04:17 +0200)]
Handle conflicting \t time intervals

If end <= start for a time interval specification, set end to the end of
the event.  VSFilter handles it like that, too.

15 years agoshift_bitmap: do not rely on compiler optimizations
Grigori Goronzy [Mon, 29 Jun 2009 00:46:45 +0000 (02:46 +0200)]
shift_bitmap: do not rely on compiler optimizations

Do not rely on the compiler for optimizing a division into a shift.

15 years agoSubpixel accurate shadow rendering
Grigori Goronzy [Mon, 29 Jun 2009 00:10:02 +0000 (02:10 +0200)]
Subpixel accurate shadow rendering

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.

15 years agoFix subpixel shift calculation for negative coordinates
Grigori Goronzy [Sun, 28 Jun 2009 00:36:31 +0000 (02:36 +0200)]
Fix subpixel shift calculation for negative coordinates

The subpixel shift calculation was off in case the device coordinates
were negative.  This has been corrected and the calculation been
simplified.

15 years agoMake \shad, \xshad and \yshad animatable.
Grigori Goronzy [Sat, 27 Jun 2009 20:48:48 +0000 (22:48 +0200)]
Make \shad, \xshad and \yshad animatable.

15 years agoSupport \xshad and \yshad override tags
Grigori Goronzy [Sat, 27 Jun 2009 20:28:22 +0000 (22:28 +0200)]
Support \xshad and \yshad override tags

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.

15 years agoSupport \xbord and \ybord override tags
Grigori Goronzy [Sat, 27 Jun 2009 20:06:32 +0000 (22:06 +0200)]
Support \xbord and \ybord override tags

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.

15 years agoFix memory leak in render_overlap
Grigori Goronzy [Sat, 27 Jun 2009 13:20:28 +0000 (15:20 +0200)]
Fix memory leak in render_overlap

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.

15 years agoFix strdup() string leaks
Grigori Goronzy [Sat, 27 Jun 2009 13:02:13 +0000 (15:02 +0200)]
Fix strdup() string leaks

On two occassions strings where strdup()'ed but never freed.  Fix these
two small memory leaks.

15 years agoMake \fax and \fay animatable.
Grigori Goronzy [Sat, 27 Jun 2009 12:26:15 +0000 (14:26 +0200)]
Make \fax and \fay animatable.

15 years agoFix rotation and subpixel placement
Grigori Goronzy [Sat, 27 Jun 2009 12:21:53 +0000 (14:21 +0200)]
Fix rotation and subpixel placement

Add subpixel shift to the points after rotation transformations to fix
rotations and subpixel accuracy.

15 years agoInclude ass_utils.h instead of mputils.h
Grigori Goronzy [Sat, 27 Jun 2009 04:52:26 +0000 (06:52 +0200)]
Include ass_utils.h instead of mputils.h

15 years agoIncorporate mputils.c into ass_utils.c
Grigori Goronzy [Sat, 27 Jun 2009 04:31:45 +0000 (06:31 +0200)]
Incorporate mputils.c into ass_utils.c

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.

15 years agoCosmetics: minor cleanup in ass_render_events
Grigori Goronzy [Sat, 27 Jun 2009 04:11:59 +0000 (06:11 +0200)]
Cosmetics: minor cleanup in ass_render_events

15 years agoCosmetics: fix a few remaining declarations
Grigori Goronzy [Sat, 27 Jun 2009 04:10:07 +0000 (06:10 +0200)]
Cosmetics: fix a few remaining declarations

Fix formatting of a few remaining declarations missed in the first
cleanup.

15 years agoRename various non-static functions
Grigori Goronzy [Sat, 27 Jun 2009 03:54:26 +0000 (05:54 +0200)]
Rename various non-static functions

Rename a few functions to avoid symbol clashes.
Clean up mputils.h.

15 years agoRename mp_msg to ass_msg
Grigori Goronzy [Sat, 27 Jun 2009 03:45:02 +0000 (05:45 +0200)]
Rename mp_msg to ass_msg

15 years agoAdd standard GPL header to mputils.c
Grigori Goronzy [Sat, 27 Jun 2009 03:35:11 +0000 (05:35 +0200)]
Add standard GPL header to mputils.c

15 years agoImprove positioning for full subpixel accuracy
Grigori Goronzy [Sat, 27 Jun 2009 04:38:49 +0000 (06:38 +0200)]
Improve positioning for full subpixel accuracy

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).

15 years agoTest program: nicer-looking background
Grigori Goronzy [Wed, 24 Jun 2009 22:05:04 +0000 (00:05 +0200)]
Test program: nicer-looking background

Use a uniformly colored background in the test program. This looks
better than the randomly-looking pattern that was used before.
A chessboard pattern would be even better, but this will do for now.

15 years agoCorrect vertical glyph positioning for \fay
Grigori Goronzy [Wed, 24 Jun 2009 21:48:05 +0000 (23:48 +0200)]
Correct vertical glyph positioning for \fay

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.

15 years agoInitial support for \fax, \fay override tags
greg [Tue, 23 Jun 2009 00:55:04 +0000 (02:55 +0200)]
Initial support for \fax, \fay override tags

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.

15 years agoUse safe hash functions for composite bitmaps
Uoti Urpala [Fri, 19 Jun 2009 16:26:36 +0000 (19:26 +0300)]
Use safe hash functions for composite bitmaps

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.

15 years agoass_cache_template.c: Undo automatic reindent for this file
Uoti Urpala [Fri, 19 Jun 2009 16:23:53 +0000 (19:23 +0300)]
ass_cache_template.c: Undo automatic reindent for this file

The 'indent' program does not understand the macro trickery in this
file and the result was clearly worse than the original.

15 years agoAdd hack to support empty lines of text
greg [Fri, 19 Jun 2009 05:34:03 +0000 (07:34 +0200)]
Add hack to support empty lines of text

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.

15 years agoRemove static variable modifier in sub_recode
greg [Fri, 19 Jun 2009 04:30:49 +0000 (06:30 +0200)]
Remove static variable modifier in sub_recode

A variable was needlessly static, this has been corrected.

15 years agoass_set_fonts: optionally pass fontconfig config path
greg [Fri, 19 Jun 2009 04:04:45 +0000 (06:04 +0200)]
ass_set_fonts: optionally pass fontconfig config path

Optionally pass a fontconfig config file to the fontconfig
initialisation.

This changes the public API.

15 years agoRemove wrappers for ass_set_fonts
greg [Fri, 19 Jun 2009 03:33:40 +0000 (05:33 +0200)]
Remove wrappers for ass_set_fonts

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.

15 years agoSilence warnings introduced by -Wall
greg [Thu, 18 Jun 2009 18:48:23 +0000 (20:48 +0200)]
Silence warnings introduced by -Wall

Silence a few warnings that should be harmless and were introduced by
the -Wall option.

15 years agoAdd -Wall to CFLAGS
greg [Thu, 18 Jun 2009 18:44:12 +0000 (20:44 +0200)]
Add -Wall to CFLAGS

15 years agoReplace manual fixed-point conversion
greg [Thu, 18 Jun 2009 16:20:09 +0000 (18:20 +0200)]
Replace manual fixed-point conversion

Replace a manual fixed-point conversion to d16 by conversion function.

15 years agoReindent all source code.
greg [Thu, 18 Jun 2009 15:54:08 +0000 (17:54 +0200)]
Reindent all source code.

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

15 years agoAdd .gitignore
greg [Thu, 18 Jun 2009 15:12:06 +0000 (17:12 +0200)]
Add .gitignore

Ignore all objects, binaries and autotools files.

15 years agoDo not print message level of a string (bloats output) and change the
greg [Thu, 18 Jun 2009 12:41:02 +0000 (14:41 +0200)]
Do not print message level of a string (bloats output) and change the
message level to MSGL_INFO.

15 years agoFix up glyph stroker to avoid buggy rendering.
greg [Thu, 18 Jun 2009 12:16:07 +0000 (14:16 +0200)]
Fix up glyph stroker to avoid buggy rendering.
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.

15 years agoSet a more reasonable maximum blur radius and make \blur animatable.
greg [Thu, 18 Jun 2009 12:15:12 +0000 (14:15 +0200)]
Set a more reasonable maximum blur radius and make \blur animatable.

15 years agoEnlarge glyph size more for \blur to avoid artefacts.
greg [Thu, 18 Jun 2009 12:14:35 +0000 (14:14 +0200)]
Enlarge glyph size more for \blur to avoid artefacts.

15 years agoRemove MAX_GLYPHS and MAX_LINES limits. Instead, dynamically allocate
greg [Thu, 18 Jun 2009 12:12:32 +0000 (14:12 +0200)]
Remove MAX_GLYPHS and MAX_LINES limits. Instead, dynamically allocate
memory and use reasonable initial sizes.

15 years agoRemove cache globals; move cache data into a separate cache_store struct
greg [Thu, 18 Jun 2009 12:09:35 +0000 (14:09 +0200)]
Remove cache globals; move cache data into a separate cache_store struct
that is part of ass_renderer.

15 years agoEliminate text_info global; move it into ass_renderer.
greg [Thu, 18 Jun 2009 12:08:49 +0000 (14:08 +0200)]
Eliminate text_info global; move it into ass_renderer.

15 years agoEliminate render_context global; move it into ass_renderer.
greg [Thu, 18 Jun 2009 12:08:27 +0000 (14:08 +0200)]
Eliminate render_context global; move it into ass_renderer.

15 years agoUse ass_renderer to access settings instead of passing a pointer to
greg [Thu, 18 Jun 2009 12:07:43 +0000 (14:07 +0200)]
Use ass_renderer to access settings instead of passing a pointer to
ass_settings, where appropriate.

15 years agoMove frame_context into ass_renderer. This finishes the previous
greg [Thu, 18 Jun 2009 12:06:40 +0000 (14:06 +0200)]
Move frame_context into ass_renderer. This finishes the previous
elimination.

15 years agoEliminate frame_context global, started.
greg [Thu, 18 Jun 2009 12:06:16 +0000 (14:06 +0200)]
Eliminate frame_context global, started.

15 years agoEliminate global_settings global.
greg [Thu, 18 Jun 2009 12:05:52 +0000 (14:05 +0200)]
Eliminate global_settings global.

15 years agoEliminate ass_renderer global.
greg [Thu, 18 Jun 2009 12:00:06 +0000 (14:00 +0200)]
Eliminate ass_renderer global.

15 years agoWarn on \pos, \move redefinitions
greg [Fri, 19 Jun 2009 03:16:30 +0000 (05:16 +0200)]
Warn on \pos, \move redefinitions

Optionally output a warning when a \pos or \move is redefined in a
single subtitle line.

15 years agoass_render.c: declare functions static
greg [Fri, 19 Jun 2009 03:14:09 +0000 (05:14 +0200)]
ass_render.c: declare functions static

Declare some functions only used in this file static.

15 years agoFrom uau: libass: Fix cache lookup problem causing memory bloat
greg [Fri, 19 Jun 2009 03:13:07 +0000 (05:13 +0200)]
From uau: libass: Fix cache lookup problem causing memory bloat

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).

15 years agoAdd autotools infrastructure.
greg [Thu, 18 Jun 2009 11:04:29 +0000 (13:04 +0200)]
Add autotools infrastructure.

15 years agoApply initial changes needed for standalone libass.
greg [Thu, 18 Jun 2009 11:00:37 +0000 (13:00 +0200)]
Apply initial changes needed for standalone libass.

15 years agoAdd a missing check for a NULL return value.
eugeni [Tue, 16 Jun 2009 17:58:12 +0000 (17:58 +0000)]
Add a missing check for a NULL return value.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29367 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agowhitespace cosmetics: Remove all trailing whitespace.
diego [Wed, 13 May 2009 02:58:57 +0000 (02:58 +0000)]
whitespace cosmetics: Remove all trailing whitespace.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoDon't automatically wrap lines when WrapStyle==2.
eugeni [Tue, 21 Apr 2009 21:27:53 +0000 (21:27 +0000)]
Don't automatically wrap lines when WrapStyle==2.

\n and \N still work.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29219 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoDocument the ass_render_event event_images parameter.
reimar [Sat, 28 Mar 2009 19:24:08 +0000 (19:24 +0000)]
Document the ass_render_event event_images parameter.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29087 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoInitialize all structs to 0 before using them.
reimar [Sat, 28 Mar 2009 19:21:34 +0000 (19:21 +0000)]
Initialize all structs to 0 before using them.
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

15 years agoCosmetics: reindent.
eugeni [Mon, 16 Mar 2009 19:26:23 +0000 (19:26 +0000)]
Cosmetics: reindent.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28977 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoFix uninitialized memory access in ass_fontconfig.
eugeni [Mon, 16 Mar 2009 19:26:19 +0000 (19:26 +0000)]
Fix uninitialized memory access in ass_fontconfig.

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

15 years agoUse ScaledBorderAndShadow: yes by default.
greg [Wed, 11 Mar 2009 22:55:23 +0000 (22:55 +0000)]
Use ScaledBorderAndShadow: yes by default.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28935 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoCosmetics: reindent.
eugeni [Sun, 8 Mar 2009 16:13:26 +0000 (16:13 +0000)]
Cosmetics: reindent.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28896 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoTreat -font/-subfont as Fontconfig pattern in libass.
eugeni [Sun, 8 Mar 2009 16:13:21 +0000 (16:13 +0000)]
Treat -font/-subfont as Fontconfig pattern in libass.

Patch by Adrian Stutz (adrian sttz ch).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28895 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoRemove extraneous braces.
greg [Sun, 8 Mar 2009 15:30:40 +0000 (15:30 +0000)]
Remove extraneous braces.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28892 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoDon't assume width == stride for bitmap composition.
greg [Sun, 8 Mar 2009 15:30:27 +0000 (15:30 +0000)]
Don't assume width == stride for bitmap composition.

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

15 years agoFix clipping for pan-and-scan.
greg [Sun, 8 Mar 2009 04:03:28 +0000 (04:03 +0000)]
Fix clipping for pan-and-scan.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28876 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoAdd a proper color check to the overlap compositing.
greg [Sun, 8 Mar 2009 04:03:24 +0000 (04:03 +0000)]
Add a proper color check to the overlap compositing.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28875 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoReplace rotation functions with a simplified version adapted from
greg [Sun, 8 Mar 2009 02:53:14 +0000 (02:53 +0000)]
Replace rotation functions with a simplified version adapted from
vsfilter.

This (mostly) fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1394#c7

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28874 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoOnly use first \org in a line.
greg [Sat, 7 Mar 2009 23:56:03 +0000 (23:56 +0000)]
Only use first \org in a line.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28873 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoFix \be blur start position.
greg [Fri, 6 Mar 2009 09:20:14 +0000 (09:20 +0000)]
Fix \be blur start position.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28837 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoRaise max. number of \be applications to 100, introduce #define for it.
greg [Fri, 6 Mar 2009 09:20:09 +0000 (09:20 +0000)]
Raise max. number of \be applications to 100, introduce #define for it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28836 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoReplace magic numbers (for subpixel accuracy masking) with a define.
greg [Fri, 6 Mar 2009 01:26:44 +0000 (01:26 +0000)]
Replace magic numbers (for subpixel accuracy masking) with a define.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28835 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoUse blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
greg [Fri, 6 Mar 2009 01:17:05 +0000 (01:17 +0000)]
Use blur with kernel [[1,2,1], [2,4,2], [1,2,1]] for \be.
This is faster than gaussian blur and similar to vsfilter.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28834 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoCombine adjacent overlapping, translucent glyph borders and shadows to
greg [Thu, 5 Mar 2009 20:47:33 +0000 (20:47 +0000)]
Combine adjacent overlapping, translucent glyph borders and shadows to
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

15 years agoFix positioned events' y-position when pan-and-scan is used.
greg [Thu, 5 Mar 2009 20:36:59 +0000 (20:36 +0000)]
Fix positioned events' y-position when pan-and-scan is used.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28823 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoSupport for subpixel accuracy of 3 bits for \pos and \move.
greg [Thu, 5 Mar 2009 20:36:56 +0000 (20:36 +0000)]
Support for subpixel accuracy of 3 bits for \pos and \move.
Also, restrict advance subpixel accuracy to 3 bits to reduce cache
bloat.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28822 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoStyle override for ScaledBorderAndShadow.
greg [Thu, 5 Mar 2009 20:36:52 +0000 (20:36 +0000)]
Style override for ScaledBorderAndShadow.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28821 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoSupport ScaledBorderAndShadow property.
greg [Thu, 5 Mar 2009 20:36:48 +0000 (20:36 +0000)]
Support ScaledBorderAndShadow property.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28820 b3059339-0415-0410-9bf9-f77b7e298cf2

15 years agoScale shadow displacement and blur size like border size.
greg [Thu, 5 Mar 2009 20:36:44 +0000 (20:36 +0000)]
Scale shadow displacement and blur size like border size.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28819 b3059339-0415-0410-9bf9-f77b7e298cf2