diff options
author | Dr.Smile <vabnick@gmail.com> | 2021-06-15 00:37:47 +0300 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2021-09-14 21:52:01 +0300 |
commit | ed462af3fdd8867ab6dc1f8664aa392f21a494bf (patch) | |
tree | 8338e23757851f4358a6718d39a84d3edb3e5a7e /libass/ass_func_template.h | |
parent | c967a5a3d9ec0d36af1148b3fdf2f307a21dd122 (diff) | |
download | libass-ed462af3fdd8867ab6dc1f8664aa392f21a494bf.tar.bz2 libass-ed462af3fdd8867ab6dc1f8664aa392f21a494bf.tar.xz |
renderer: use complementary equations for \clip and \iclip
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.
Diffstat (limited to 'libass/ass_func_template.h')
-rw-r--r-- | libass/ass_func_template.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libass/ass_func_template.h b/libass/ass_func_template.h index f986295..3556a76 100644 --- a/libass/ass_func_template.h +++ b/libass/ass_func_template.h @@ -34,9 +34,9 @@ void DECORATE(fill_generic_tile32)(uint8_t *buf, ptrdiff_t stride, void DECORATE(add_bitmaps)(uint8_t *dst, intptr_t dst_stride, uint8_t *src, intptr_t src_stride, intptr_t width, intptr_t height); -void DECORATE(sub_bitmaps)(uint8_t *dst, intptr_t dst_stride, - uint8_t *src, intptr_t src_stride, - intptr_t width, intptr_t height); +void DECORATE(imul_bitmaps)(uint8_t *dst, intptr_t dst_stride, + uint8_t *src, intptr_t src_stride, + intptr_t width, intptr_t height); void DECORATE(mul_bitmaps)(uint8_t *dst, intptr_t dst_stride, uint8_t *src1, intptr_t src1_stride, uint8_t *src2, intptr_t src2_stride, @@ -105,7 +105,7 @@ const BitmapEngine DECORATE(bitmap_engine) = { #endif .add_bitmaps = DECORATE(add_bitmaps), - .sub_bitmaps = DECORATE(sub_bitmaps), + .imul_bitmaps = DECORATE(imul_bitmaps), .mul_bitmaps = DECORATE(mul_bitmaps), .be_blur = DECORATE(be_blur), |