| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
This should help with potential combinatorial explosion.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If static libass is linked into a binary defining functions
of the same name there will be issues. To avoid this use an
ass_ prefix for namespacing.
Before this commit we already did this for most but not yet
all internal API.
read_file is renamed to ass_load_file as ass_read_file
already exists as a public API function. All other functions
are simply prefixed with ass_.
Fixes: https://github.com/libass/libass/issues/222
Fixes: https://github.com/libass/libass/issues/654
|
|
|
|
|
|
| |
Although declared and defined in ass_utils.{h,c},
those functions are only used in one other file
and aren't useful at other places.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We detect x86 and enable building asm code in `configure`.
However, before this commit, we don't actually use that code
unless we detect x86 via the C compiler's predefined macros.
We could check more macros to support more C compilers,
but what we really want is to use the same trigger
for both building and using this code. To that end,
add ARCH_X86 to config.h iff x86 asm is being built.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic symmetry considerations require that
clip_func(src, clip) = iclip_func(src, 255 - clip),
but we use unrelated expressions for them:
clip_func(src, clip) = (src * clip + 255) / 256 !=
iclip_func(src, iclip) = max(src - iclip, 0) = max(src + clip - 255, 0).
Version with multiplication is more correct (albeit slower) as it gives
results closer to the infinite resolution reference (per compare -s 8)
in case of half-transparency. So I've picked better function
(clip variant) and derived another from it.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Render logic should depend only on input subs
and not on some internal state such as bitmap pointers.
That can prevent incorrect behavior in case of allocation failure.
|
|
|
|
|
|
| |
Now ass_synth_blur() blurs one bitmap only.
Higher level decisions (to blur or not to blur)
have moved outside of that function.
|
|
|
|
|
| |
This allows to use Bitmap struct directly as cache value
and to remove bunch of unnecessary allocations.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
We're not aware of any specific reason for this number to be used,
and actual potentially-dangerous cases should be handled by the
other limits.
Fixes #260
|
|
|
|
| |
This can improve perf somewhat with large bitmaps
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Another consequence of the trickiness in this code. This codepath for
opaque_box=1 assumes both bm_o and bm_g are set, but if memory
allocation fails somewhere, bm_o could be non-NULL, but bm_g NULL, which
then would result in a crash when accessing bm_g.
Possibly this code could be cleaned up to look much nicer (and not have
dozens of hidden, obscure bugs), but for now this fixes the potential
crash found by Coverity.
Fixes CID 146125.
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Also fix a related sort-of-bug: a multiple of sizeof(uint16_t)
was being added to a pointer that already pointed to uint16_t.
This was not causing any harm given enough space in the buffer.
Fixing the above also lets us combine the two memsets.
|
| |
| |
| |
| |
| | |
To avoid making bitmaps unnecessarily large, use just
the necessary amount of padding for the given \be value.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid banding in the output, the full [0..255] value range
is restored before the last \be pass, which then uses the full
range and hides the bands by virtue of being a blur.
With this, our \be finally closely matches VSFilter's.
The only visible difference (other than the lack of banding) is
in clipping: we add proper padding and output the whole blurred
image, while VSFilter does not add any padding and hence clips
the blurred image too early.
|
| | |
|
| |
| |
| |
| |
| | |
The implementation of \be was changed to xy-VSFilter's, which (like
VSFilter's) reads but does not write out the first/last row/column.
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Much of outline_to_bitmap() is duplicated. What?
Add the overflow check to duplicated code too.
|
|
|
|
|
|
| |
Seriously...
Checking for negative values might not be needed, but do it anyway.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
Commit 8536eaa was slightly broken: for some incomprehensible reason,
(w + 1) memory instead of w is needed. The missing space could lead to
memory corruption and crashes.
|
|
|
|
| |
Also fix that ass_synth_init() could deref NULL.
|
| |
|
|
|
|
| |
Put all code into one place, which makes it easier to follow.
|
|
|
|
| |
This still doesn't catch all cases.
|
|
|
|
| |
This is just a start and gets most easy ones.
|
|
|
|
| |
Part of #146
|
| |
|
| |
|
|
|
|
| |
It turns out we don't need this.
|
| |
|
|
|
|
| |
Signed-off-by: Rodger Combs <rodger.combs@gmail.com>
|
|
|
|
| |
Regression in commit 98707694.
|
|
|
|
|
|
|
|
|
| |
5dd56af2 replaced our implementation of \be with xy-VSFilter's.
This error is not present in the xy-VSFilter code; it was introduced
by accident in a merge that was later squashed as part of 5dd56af2.
Note: the new \be reads in but does not write out
the first and last row and column of pixels.
|
|
|
|
|
|
| |
Signed-off-by: wm4 <wm4@nowhere>
Commit 04b51c2d broke BorderStyle=3 with text that had spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Freetype can return a bounding box with all fields set to INT_MIN if an
outline with all points set to 0 is used. This can happen e.g. with
\fscx0, but also in more complicated cases. (In the original crashing
sample, this was probably caused in combination with an embedded font.)
Such a bounding box causes libass to crash, because it will enlarge the
combined bitmap bounding box to a ridiculous size.
Just skip outlines that have en empty bounding box. This is probably
the correct thing to do, and won't pass INT_MAX down to other parts
of libass.
|
| |
|
|
|
|
| |
...instead of doing this manually.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Based on xy-VSFilter commit 54391d3a.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Even if the border size is zero, the shadow is supposed to be
a copy of a hypothetical border: when border_style is 1, this
coincides with the borderless glyph, but when border_style is 3,
the shadow must be an opaque box.
Opaque box borders are now generated regardless of border size
being non-zero, and outline_to_bitmap3 gets a new flag indicating
whether it should discard the border (after generating a shadow
from it).
|
| |
|
|
|
|
|
|
| |
This horrible bug was introduced by commit c13cb2.
Pointed out by uau.
|
| |
|
|
|
|
|
| |
Add stride support to the basic bitmap type used for low-level
rasterization.
|
| |
|
|
|
|
|
| |
This covers rasterization, filtering and blending for one
render item.
|
|
|
|
|
|
|
|
|
|
|
|
|
|