| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Accuracy of border outline calculation should depend on subsequent
transformation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Leading newlines are now rendered, but still incorrectly:
at full height rather than at half-height as required.
|
|
|
|
|
| |
Note that return value is reversed in parse_events(),
ass_render_event() and ass_start_frame() functions.
|
|
|
|
| |
Purpose of this commit is to simplify logic behind drawing handling.
|
|
|
|
|
| |
Drawings always have advance.y = 0 and
FreeType guarantees that for horizontal writing.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Previously each \r triggered full rescan of event string.
After this commit such scanning is done once in init_render_context().
Additionally some lines have moved around to correctly account for
state.evt_type (calculated in apply_transition_effects) and
state.explicit (used in reset_render_context).
That should fix cases with incorrectly applied style overrides
for subs with banner scrolling effect before the first \r.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
\t with no parantheses inside \t() resets the animation parameters
of the \t() for subsequent tags, so they are animated as if the \t()
was the single-argument version regardless of the actual number
of arguments the \t() has.
Equivalently, you could say parentheses are implied for \t inside \t().
For example, \t(20,60,\frx0\t\fry0\frz0) animates \frx from 20 to 60 ms
and animates \fry and \frz for the whole duration of the line,
just like \t(20,60,\frx0)\t(\fry0\frz0) or \t(20,60,\frx0\t(\fry0\frz0)).
Technically, VSFilter simply resets the animation parameters for any \t
it encounters but parses the embedded tags only if the \t has the right
number of arguments. However, top-level animation parameters don't matter
because top-level tags are not animated, while any nested \t that has
parentheses terminates the containing \t because they share the closing
parenthesis, so the fact that a nested \t with empty parentheses or with
at least four arguments changes the animation parameters also doesn't
matter because the containing \t immediately ends and the changed
parameters have nothing to apply to. Thus the only situation where
this has a visible effect is a nested \t without parentheses.
Closes https://github.com/libass/libass/pull/296.
|
|
|
|
| |
This commit is mostly transparent to `git blame -w`.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Found by coverity scan.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Text background refers to the libass-only BorderStyle 4, which is
similar to 3, but isn't affected by outline/border size and doesn't
render shadow, so shadow offset can be used.
You can override the horizontal and vertical box size separately
with override tags, just like you can override the color with
shadow color.
Closes #270
|
|
|
|
|
|
|
| |
The value used to generate outline cache values is 26.6, so there
is no point in storing the more precise 16.16 in the cache key.
Indeed, this can only reduce the efficiency of the cache
and provide an extra opportunity for overflow.
|
|
|
|
|
|
|
|
|
| |
border_scale can change, e. g. when ass_render_frame is called twice with
the same renderer but different tracks. Glyphs with equal \bord tag values
but different border_scale values produce different border outlines and
hence should be distinguished in outline cache keys. To this end, store
scaled border widths (which are really used when generating the outlines)
in cache keys instead of \bord tag values.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
has_clips was a workaround for the case where a new image reused
the same memory address as another image used in the previous frame.
In case of such reuse, comparison by pointer address failed
to distinguish the different images in ass_detect_change().
After commit dd06ca30ea79ce50116a43cc5521d4eaf60a017e,
images in the previous frame are no longer freed before
the comparison with current frame. Thus no such reuse can occur,
and the workaround is redundant.
See https://github.com/libass/libass/pull/258.
|
|
|
|
|
|
|
|
| |
ASS_Images returned by libass are guaranteed to be clipped. Not doing
this will cause invalid memory accesses in applications which try to use
this guarantee.
Fixes #254.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Subtitle recommendations often include that multi line
subtitles should be left justified as this is easier for
the eyes. This is also the standard used by several television
companies.
This add the possibility to define how subtitles are to
be justified, independently of where they are aligned.
The most common way could be to set justify to left, and have
alignment to center. But you can, for example, have alignment
to left and justify to center, giving subtitles to the left but
justifed on the center (instead of normal left justified).
Using justify right and alignment of center, might be good
choice for Arabic.
If justify is not defined, all works like before.
If justify is defined, subtitles are aligned as defined
by alignment and justified as defined by justify.
ASS is not extended by this, justify can only be defined
by setting Justify to wanted justification.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes two separate bugs:
a) Don't move a linebreak into the first symbol. This results in a empty
line at the front, which does not help to equalize line lengths at all.
Instead, merge line with the second one.
b) When moving a linebreak into a symbol that already is a break, the
number of lines must be decremented. Otherwise, uninitialized memory
is possibly used for later layout operations.
Found by fuzzer test case
id:000085,sig:11,src:003377+003350,op:splice,rep:8.
This might also affect and hopefully fix libass#229.
v2: change semantics according to review
|
|
|
|
| |
This can improve perf somewhat with large bitmaps
|
| |
|
|
|
|
|
| |
That resources can be cached composite bitmap or raw bitmap buffer.
Consequently, free lists are no longer needed.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
As before, this does not add any build system support:
a config.h file and a project must still be manually created
(or the compiler can be run manually instead of using a project).
Signed-off-by: Grigori Goronzy <greg@kinoho.net>
Signed-off-by: Oleg Oshmyan <chortos@inbox.lv>
|
|
|
|
| |
Fixes CID 146421.
|
|
|
|
|
|
|
|
|
|
| |
The logic here is pretty complicated. The caller of this function guards
it with "if(info->bm || info->bm_o){", and generally indeed only one of
them is set. But in some cases, both are needed. fix_outline()
definitely dereferences both. This is not necessarily guaranteed, e.g.
on out of memory errors. Add the missing checks.
Fixes CID 146125.
|
|\ |
|
| |
| |
| |
| |
| | |
FreeType can do it for us and is probably more efficient. Also fixes
deinitialization order of ASS_Renderer to make this work.
|
| |
| |
| |
| |
| |
| |
| | |
Implement a simple font sorter (FontSelector) and an interface to deal
with multiple font sources (FontProvider). Unfinished business,
but works for the most part. Currently the only implemented FontProvider
uses fontconfig.
|
|/
|
|
|
|
|
|
|
| |
This corrects the calculated width of events that contain \N\N,
which previously included the width of the glyph corresponding
to '\n' (more generally, for n consecutive line breaks, only
the first glyph was skipped and n-1 glyphs were included).
Reported on IRC.
|
|
|
|
|
|
|
|
|
|
| |
That's complete version with SSE2/AVX2 assembly.
Should be much faster than old algorithm even in pure C.
Algorithm description can be found in this article (PDF):
https://github.com/MrSmile/CascadeBlur/releases
Close #9
|
|
|
|
|
|
|
|
|
|
| |
Use one pointer to table of functions instead of scattered
bunch of function pointers. Different versions of these tables
can be constructed in compile time.
Also, bitmap memory alignment now depends only on SSE2/AVX2 support
and is constant for every width. That simplifies code without
noticeable performance penalty.
|
|\
| |
| | |
\be fixes including clipping and value range
|
| |
| |
| |
| |
| | |
To avoid making bitmaps unnecessarily large, use just
the necessary amount of padding for the given \be value.
|
| | |
|
| |
| |
| |
| |
| | |
Even if we wanted this, the result would be inconsistent if e.g. \clip
is used.
|
| |
| |
| |
| | |
Reported by clang scan-build static analysis.
|
| |
| |
| |
| |
| |
| | |
Reported by clang scan-build static analysis. This cannot happen with
the current code, but the check might make this more robust in case
anything changes.
|
| |
| |
| |
| |
| |
| | |
Only normal dialog lines are allowed to appear outside.
Fixes #177.
|
| | |
|
| |
| |
| |
| |
| |
| | |
What.
Closes #175.
|
| |
| |
| |
| |
| | |
This really didn't make a lot of sense. This is a simplification, and
should not affect actual program behavior.
|
| |
| |
| |
| |
| |
| |
| | |
libass already does not use the margins for events using \pos. This is
not quite complete: there are other tags that we consider as "not
dialogue", and which should not be overridden. These tags do not use
EVENT_POSITIONED, and thus use the margins, which can mess up rendering.
|
| |
| |
| |
| | |
Just move the *_pos ones about the variants without this postfix.
|
| | |
|
| |
| |
| |
| | |
Similar to xy-VSFilter.
|
| |
| |
| |
| |
| |
| |
| |